1. A compiler device for optimizing a program which manipulates a character string, the compiler device comprising: an append instruction detection unit for detecting an append instruction to append a character string to a string variable for storing a character string, in the program; a store code generation unit for generating, as a substitute for each of a plurality of the append instructions detected by the append instruction detection unit, a store code for storing data of an appendant character string to be appended to the string variable by the append instruction into a buffer, the plurality of append instructions appending the character strings to the same string variable; and an append code generation unit for generating an append code for appending a plurality of the appendant character strings to the string variable, at a position to be executed before an instruction to refer to the string variable in the program.