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 🤩 !
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.
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 😅 .
- https://www.nand2tetris.org - you can find the Nand2Tetris course on coursera
- https://interpreterbook.com - is an amazing book I went through before Nand2Tetris from which I remembered some bits about a possible structure and readable tests