1. A non-transitory computer-readable recording medium having stored therein an encoding program that causes a computer to execute a process comprising: generating a plurality of pieces of syntax information respectively corresponding to a plurality of words in a compression target document by analyzing relationships between the plurality of words; assigning a plurality of compression codes to the plurality of words and to the plurality of pieces of syntax information; and outputting the plurality of compression codes with an arrangement of a specific order.