This is a tiny assembler writen in sml and compile in smlnj, which convert assembler language to machine language. It is also nand2tetris’s 6st project.
$ smlnj
- use "assembler.sml";
- init "filepath";
$ diff yourhackfile test/hackfile
allDigits allInRange checkDigit readLines removeCarriageReturn removeHeadSpaces removeTailSpaces removeComment readFile replaceDigestLabelsAndVariables replaceDigestLabels replaceDigestLabelsHelper getLabelPairsVariables replaceVariablesHelper process getBinary getBinaryHelper appendZero getBinaryInstruction parseInstruction init write
- Each phase or module of the assembler belongs in its own structure.
- Exception and space handle
- Implement hashtable to store symbols.
- Too many nested functions, I should reformated them
This project is inspired by CestDiego’s nand2tetris.el a lot. I also learn some elisp skills from his project