JackCompiler Bug on ConvertToBin?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JackCompiler Bug on ConvertToBin?

rgfibe
I'm debugging my compiler by comparing its output to the output of the supplied JackCompiler. I use the supplied JackCompiler to create the Main.vm file
(on Ubuntu, by running ./tools/JackCompiler.sh ../projects/11/ConvertToBin/Main.jack).

The Main.jack file has two different while loops, which get converted by the supplied JackCompiler into two while loops with the same labels:
"label WHILE_EXP0" shows up in line 20, and again in line 94.
"label WHILE_END0" shows up in line 74, and again in line 113.

This seems like too huge a bug to have remained undetected for so long, so maybe I'm missing something. Could someone verify if they get the same result? The Main.vm file produced by the supplied JackCompiler does not work as it should in the VMEmulator.

Thanks,
Ricardo

Reply | Threaded
Open this post in threaded view
|

Re: JackCompiler Bug on ConvertToBin?

cadet1620
Administrator
It's OK to have duplicate labels as long as they are in different functions. This is why the class and function name is added to the label name by the VM translator.

In the case of ConvertToBin/Main.vm, my VM translator generates ASM labels:
    (Main.convert$WHILE_EXP0)
    (Main.convert$WHILE_END0)
    (Main.fillMemory$WHILE_EXP0)
    (Main.fillMemory$WHILE_END0)

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: JackCompiler Bug on ConvertToBin?

rgfibe
Thanks Mark, I forgot my assembly.

For anyone having trouble running ConvertToBin, I now figured that I have to press the stop button to see the changes in RAM[8001..8016]. And I can only change the value at RAM[8000] if Animation is on.