Skip to content

hashcatHitman/hack-vm-translator

Hack VM Translator

unsafe forbidden dependency badge CI status CodeQL


A translator that translates programs written in the Hack VM language into Hack assembly instructions. Based on the nand2tetris course, and written in Rust.

Getting Started

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-translator

If you'd like to read the documentation, the recommended way to do so is with:

cargo doc --document-private-items --open

Which will open the documentation in your browser.

To build the project, you can do:

cargo build --profile release --locked

Cargo 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.vm

Where Foo can be variable, but should remain valid Unicode.

MSRV Policy

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.)

About

A VM translator that parses Hack VM commands and generates Hack assembly.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE.md
MIT
LICENSE-MIT.md

Contributing

Security policy

Stars

Watchers

Forks