Skip to content

FirstLoveLife/Assembler-for-nand2tetris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.

Use

$ smlnj
- use "assembler.sml";
- init "filepath";
$ diff yourhackfile test/hackfile

outline

allDigits
    allInRange
    checkDigit
readLines
    removeCarriageReturn
    removeHeadSpaces
    removeTailSpaces
    removeComment
    readFile
replaceDigestLabelsAndVariables
    replaceDigestLabels
        replaceDigestLabelsHelper
    getLabelPairsVariables
        replaceVariablesHelper
process
    getBinary
        getBinaryHelper
    appendZero
    getBinaryInstruction
    parseInstruction
init
          write

todo

  • 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

Thanks

This project is inspired by CestDiego’s nand2tetris.el a lot. I also learn some elisp skills from his project

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published