Python implementation of the nand2tetris' Hack Assembler Program. Build for project 6 of the nand2tetris course on coursera.
Develop an assembler that translates programs written in Hack assembly language into the binary code understood by the Hack hardware platform.
- Parse the Hack Assembly code file (*.asm)
- Handle whitespaces
- Handle comments:
- Line comments
- Inline comments
- Must be able to translate two types of instructions:
- A-instruction
- C-instruction
- Must be able to track symbols and labels
- Write the generated code into a file (*.hack)
-
Parser
module: Encapsulates access to the input code. Reads an assembly language command, parses it, and provides convenient access to the command’s components (fields and symbols). In addition, removes all white space and comments. -
Code
module -
Main
module -
Use a
HashTable
to handle symbols and labels
- This project is a good programming exercise.
- I will use it to practice TDD and Unit Testing.
- I will use
unittest
module of Python.
Feel free to contact me for queries:
Email: hussainbhaitech@gmail.com
Instagram: @NagariaHussain