I can't understand how should I choose a name for my function. In the slide 22 there's written "each label b command in a VM function f should generate a globally unque symbol f&b..." I don't understand how to "build" these symbol. It says that f is the name of the function, for example foo, and "b is the label within VM function's code", where? Then it refers to the function saying "goto b", so it seems to me that also b is the name of the function. Someone can explain me this?
Vm function command names are used by VM call commands. The name must be unmodified so that call commands in other VM files can call the function. For example, the VM command
generates the assembly language label
Vm label command names are used by VM goto and if-goto commands to build loops and conditional code within individual functions. A label command in function Main.main may use the same name as a label command in function Main.run, so the name must be modified.
The suggested modification is to combine the name of the current function with the label command's name using a '$' character. For example
It's like writing std::mult in C. In f$b f is the function father of label b that is the label son of function f.
So I could write loop1, loop2 etc. instead of f$b and it would work in the same way, it would be just a lot more difficult understanding and reading the code.
This gave me another doubt: this label naming convention should be applied only to function's labels or to every label in asm?