teleivo / hack-assembler

Assembler for the Hack assembly language https://www.nand2tetris.org/project06

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hack Assembler (nand2tetris)

Hi ๐Ÿ˜ this is one of my learning projects, an assembler for the Hack assembly language. The language is defined in https://www.nand2tetris.org/project04. The assembler project itself is documented in https://www.nand2tetris.org/project06.

https://www.nand2tetris.org is an amazing course ๐Ÿคฉ !

Quickstart

To run the assembler once do

go run cmd/assembler/main.go testdata/Add.asm

otherwise build the above into a binary ๐Ÿ˜„ .

The machine code is written as text instead of binary as that is what was required in https://www.nand2tetris.org/project06.

Tests

I added ample tests written in Go for the parsing and translation logic. The machine code generated by this repos assembler is identical to the machine code generated by https://www.nand2tetris.org/project06 for the given sample programs. There might of course still be bugs. Please let me know if you find one ๐Ÿ˜… .

Resources

About

Assembler for the Hack assembly language https://www.nand2tetris.org/project06

License:MIT License


Languages

Language:Go 100.0%