Transforms Hack Assembly into Hack Machine Language
Go to file
Collin J. Doering 6a4f9ef5b4 Restructured cabalized project
Moved hack assembly parser into its own library, as this is a more
modular setup and opens the possibility of adding additional front
ends (Eg. a web front end).

Currently there is one executable 'Asmblr' which is the command line
front end. See README.md for more details of its operation.

Signed-off-by: Collin J. Doering <collin.doering@rekahsoft.ca>
2015-06-17 17:53:37 -04:00
doc/examples Cabalized and modularized project 2015-06-16 18:33:26 -04:00
src Restructured cabalized project 2015-06-17 17:53:37 -04:00
testsuite Cabalized and modularized project 2015-06-16 18:33:26 -04:00
.gitignore Cabalized and modularized project 2015-06-16 18:33:26 -04:00
Asmblr.cabal Restructured cabalized project 2015-06-17 17:53:37 -04:00
LICENSE Cabalized and modularized project 2015-06-16 18:33:26 -04:00
README.md Cabalized and modularized project 2015-06-16 18:33:26 -04:00
Setup.hs Cabalized and modularized project 2015-06-16 18:33:26 -04:00

README.md

Hack Assembler in Haskell

Asmblr is a small Haskell program that transforms Hack Assembly into its machine language representation.

Features

  • Follows a similar structure to the implementation describe by the Nand to Tetris book
  • Faster then the implementation given with the Nand to Tetris course
  • Can read from stdin and write to stdout (if requested)
  • Uses open-source tools wherever possible

Building

Asmblr requires GHC and cabal to be built and can be done like so:

$ cabal configure
$ cabal build

Once built, the Asmblr executable will be in the dist/build/Asmblr folder, and can be run using cabal, or your shell. The Asmblr program can also be installed using cabal install. For more information on installing cabal packages and using cabal see its manual.

Tools

The creation of this software was made possible by the following open source tools and libraries.

  • Gnu Emacs, because there is no place like home; and no greater editor!
  • GHC, for compilation of Haskell code
  • Cabal, for building the project

License

This project is licensed under the GPLv3. Please see the LICENSE file for full details.

Issues

There are some minor issues that can be cleaned up in future releases. Namely, making error output more human readable, and a few minor optimization's.

  • Explicitly handle if input file dne or is unreadable
  • Explicitly handle if output file is un-writable
  • Create ParseException type to throw from parser and can be caught in Asmblr.defaultMain
  • Add ( "error description") throughout parsers to make error output more readable
  • Re-factor cInstrDest and cInstrAluOps to remove unneeded use of 'try' for optimization's sake
  • Write tests so that future changes don't break things (see folder testsuite)