Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Assembler for Hack Computer

An assembler that compiles Hack Computers' Assembly (.asm) file to Hack Computer Machine Code. This project is done as a part of the Nand2Tetris course on Coursera.

The Hack computer is a virtual computer built as a part of the course to build an understanding about the inner workings of a modern computer.

For more information please visit nand2tetris.org.

Note: Please be advised that the file in this repository is a compiled assembler and does not contain the source code.

Running the assembler

Linux/MacOS:

# change directory to the assembler.pyc location

chmod 500 assembler.pyc && python3 assembler.pyc

Windows (Powershell):

# change directory to the assembler.pyc location

.\assembler.pyc

OR

# change directory to the assembler.pyc location

python.exe .\assembler.pyc

Usage

The assembly file path can be supplied in the command line arguements

python3 assembler.pyc [path/to/file.asm]

(OR)

the program will ask for a file location if the argument is not supplied

python3 assembler.pyc
# Output:
# Enter file location:

The machine code for the given assembly code is written to path/to/file.asm.output.hack after the execution.

Areas of improvement

  • Implement a better parser. Preferably using Abstract Syntax Trees.
  • Implement better anomaly detection and handling.
  • Add verbose syntax error messages.

About

Contains the compiled binaries for Hack Assembly Language Assembler.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Contributors