Skip to content

yuvraj1803/hack_assembler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The Hack Assembler converts Assembly code to the Hack Machine code.

Components of the assembler: Parser + Translator + Symbol Table

project-diagram

How to run? The executable file is present in the cmake-build-debug/ directory. After navigating to it, type "./hack-assembler ". Flags supported: -c : prints the assembly code without comments, spaces or new-lines.

Eg: ./hack-assembler -c add/Add.asm

This creates a .hack file in the same location of your assembly file.

Update 1

->I felt the entire project was cluttered and unorganised.

->An extra layer of abstraction has been added.

->Hence in this update, the Assembler class has been added which internally takes care of the parser, translator and the symbol table.

-> Assembler::Assembler(string &assembly_file) => constructor takes in the input file (containing assembly code).

-> Assembler::clean_code => assembly code with comments, spaces and new-lines removed.

-> Assembler::machine_code => final machine code generated as per the hack machine language specification.

Update 2

-> Added all classes into a directory of their own.

-> Modified include statements accordingly.

-> Updated CMakeLists.txt

*** Update 3***

-> Fixed a bug where Assembler::clean_code was always empty.

-> Flags can be passed while running on a command-line interface.

About

Assembler for the Hack Architecture. Converts Assembly Code to Machine Code.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published