stansbuj wrote
Can a single vm file have duplicate labels in it?
The following code fragment was generated by the Nand2Tetris compiler for the PongGame.jack file. Note there are duplicate labels in it. I indented the sequence of code that is duplicated.
function PongGame.run 1
...
if-goto IF_TRUE0
goto IF_FALSE0
label IF_TRUE0
...
function PongGame.moveBall 5
...
if-goto IF_TRUE0
goto IF_FALSE0
label IF_TRUE0
This is not a bug.
The VM language specification (8.2.1) says that labels have function scope, thus PongGame.run.IF_TRUE0 and PongGame.moveBall.IF_TRUE0 are unique labels.
--Mark