Understanf that your VM translator does not need to add the VM filename to goto labels. The name on the function statement already includes the class name.
Here's the big picture.
MyClass.jack contains the code:
class MyClass {
function void foo (int x) {
while (x > 0) {
let x = x-1;
}
return;
}
}
This compiles to MyClass.vm:
function MyClass.foo 0
label WHILE_EXP0
...
if-goto WHILE_END0
...
goto WHILE_EXP0
label WHILE_END0
...
VM translator generates:
// function MyClass.foo 0
(MyClass.foo)
// label WHILE_EXP0
(MyClass.foo$WHILE_EXP0)
...
// if-goto WHILE_END0
...
@MyClass.foo$WHILE_END0
D;JNE
...
// goto WHILE_EXP0
@MyClass.foo$WHILE_EXP0
0;JMP
// label WHILE_END0
(MyClass.foo$WHILE_END0)
...
--Mark