A translator that translates programs written in the Hack VM language into Hack assembly instructions. Based on the nand2tetris course, and written in Rust.
You'll need to install Rust and its package manager, Cargo, on your system. Please refer to the official recommended Rust installation method for your system.
You should also have some version of git installed. You can refer to the Git documentation if you need help with that.
Clone the repository and navigate inside it:
git clone https://github.com/hashcatHitman/hack-vm-translator.git
cd hack-vm-translatorIf you'd like to read the documentation, the recommended way to do so is with:
cargo doc --document-private-items --openWhich will open the documentation in your browser.
To build the project, you can do:
cargo build --profile release --lockedCargo will download the dependencies and compile the project. It will probably
be located at ./target/release/hack-vm-translator or
./target/release/hack-vm-translator.exe, depending on your system.
Though relative pathing seems to work fine, for the best experience it is
recommended to keep your *.vm files and the translator in the same directory.
If you are doing so and are in the directory yourself, you can translate a
*.vm file to the equivalent *.asm file like so:
./hack-vm-translator Foo.vmWhere Foo can be variable, but should remain valid Unicode.
Our current Minimum Supported Rust Version (MSRV) is 1.89.
We may increase the patch level of the MSRV on any release.
Otherwise, we will not increase MSRV on PATCH releases, though our dependencies might.
We won't increase MSRV just because we can: we'll only do so when we have a reason. (We don't guarantee that you'll agree with our reasoning; only that it will exist.)