Project 7 Note

The virtual machine is a stack based machine and we are translating its language to a Von Nuemann machine:

What they share is two operands, arithmetic/logic, and a place to put the results. The former is filo on the stack, the later uses AMD for storage. On the surface these two machines may at first appear to be hugely different, but under the hood they are nearly identical.

This program will eventually need to read in all .vm files in a directory, create a separate Parser for each file and output a .asm file using only one Codewriter.  The book cleverly lays out the functionality of the Parser and Codewriter to help us make this transition. It will be easier to input the file name using command line arguments per the books suggestion uder Design Suggestion for the VM Implementation, 7.3.2. Also, try to stick to the program structure described in 7.3.3 by looking closely at the VM specification part 1 in 7.2.1-3 paying particular attention to Figure 7.5.

The VM translator is designed to generate Hack assembly code per the Hack assembly language rules (section 4.2). But we are starting with only the Stack Arithmetic which pushes and pops constants. Try not to be daunted by the full scope of this project. If you get phase 1 to work the others will follow.

VMtranslator.zip

PointerTest explained