I wrote CodeWriter in Python and I'm having a heck of time debuggin this. Anyone familiar with Python and willing to look at my code with fresh eyes to find my error?
My code produces an .asm file just fine. when I translate StackTest.vm, the comparison in the CPUEmulator is successful. However, when I run I translate BasicTest.vm and run the file through the CPUEmulator there is a comparison failure. So, yes, I added print statements throughout my assembly code so that I can compare it with the vm code but the assembly code seems correct to me.
Any suggestions concerning debugging would be greatly appreciated
Start with identifying what values are miscomparing.
RAM[256] is the final result on the stack at the end of the program,
RAM[300] is the beginning of the 'local' segment,
RAM[400] is the beginning of the 'argument' segment,
RAM[3000] is the beginning of the 'this' segment,
RAM[3010] is the beginning of the 'that' segment,
RAM[11] is 'temp 6'.
Look at StackTest.vm and examine the code you generated for the commands that were supposed to set those values.