A Nand2Tetris Assembler written in Rust! This assembler is designed to translate assembly language from the Nand2Tetris course (.asm
files) into binary code (.hack
files), allowing you to run your Hack assembly programs on the Hack hardware platform.
Before you can use this assembler, you need to have Rust installed on your machine. If you don't have Rust installed, you can download it from the Rust website.
To build the assembler, you will use Cargo, Rust's package manager and build system. Simply follow these steps:
-
Clone this repository to your local machine using Git:
git clone [email protected]:tairasu/hack-assembler.git
-
Navigate into the project directory:
cd hack-assembler
-
Build the project using Cargo:
cargo build --release
The
--release
flag builds the assembler in release mode, which optimizes the binary for performance.
After building the assembler, you can use it to convert .asm
files to .hack
binary files.
To run the assembler, use the following command:
./rust-assembler <filepath>
Replace <filepath>
with the path to your .asm
file. The assembler will generate a .hack
file in the same directory as your .asm
file.
Assuming you have an assembly file named Max.asm
in your current directory, you can assemble it into a binary file named Max.hack
with the following command:
./rust-assembler Max.asm
Distributed under the MIT License. See LICENSE
for more information.
- This project is inspired by the Nand2Tetris course, and it's dedicated to everyone involved in creating and maintaining this resource.