Skip to content

A program that translates Hack virtual-machine language code (as defined in the nand2tetris course) into Hack assembly code.

License

Notifications You must be signed in to change notification settings

mfl28/HackVMTranslator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HackVMTranslator

Build Status Language grade: C/C++

OS Build & Test Pipeline Status
Linux Build Status
MacOS Build Status
Windows Build Status

This is a C++-implementation of a translator for the Hack-platform's virtual-machine language as defined in project 7 and project 8 of the nand2tetris-course. The program takes as argument either a single .vm-file or a directory containing such files, translates them into Hack assembly-language code and writes this code into a single .asm-file.

Building the program

Note: To build this program, a compiler that supports C++17 and std::filesystem is required (e.g. gcc version ≥ 8).

git clone https://github.com/mfl28/HackVMTranslator.git
cd HackVMTranslator
cmake -B build    # Use option "-D BUILD_TESTING=OFF" if you do not want to build the unit-tests.
cmake --build build   

Running the program

After you built the program, do the following from within the build-directory:

Linux

./HackVMTranslator path/to/filename.vm    # Or "./HackVMTranslator path/to/directory"

Windows

cd Debug    # Or "cd Release" if you built using Release-configuration.
.\HackVMTranslator.exe path\to\filename.vm    # Or ".\HackVMTranslator path\to\directory"

Running the tests

If you built the program including the unit-tests, then these can be run from within the build-directory by doing the following:

Linux

ctest -V

Windows

ctest -C Debug -V    # Or "ctest -C Release -V" if you built using Release-configuration.

References

About

A program that translates Hack virtual-machine language code (as defined in the nand2tetris course) into Hack assembly code.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published