1. A compiling method, the method comprising: simulating program code which includes at least one first operation command to generate a first operation result; translating the program code into machine code of a processor that comprises at least one second operation command; simulating the machine code to generate a second operation result; and comparing the first operation result with the second operation result to verify whether the machine code is valid, wherein: the translating of the program code comprises register-allocating the program code, and the simulating of the program code comprises simulating the program code by referring to stack information of the machine code, which is generated after the program code is register-allocated.