Giter Site home page Giter Site logo

tearitco / hackassembler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zakuarbor/hackassembler

0.0 0.0 0.0 233 KB

An assembler written in C to translate assembly to machine code for the Hack Computer Architecture from Nand2Tetris

C 98.93% Makefile 1.07%

hackassembler's Introduction

Hack Assembler

Hack Assembler is an assembler to translate Hack Assembly to Hack Machine code written in C. This assembler is part of a project from Nand2Tetris Part 1 where students design a simple 16 Bit Computer which is called the "Hack Computer". Students starts off with creating logic gates from NAND to eventually build a simple operating computer.

Although I have made my solutions for the other projects in this course private (as well as most of my assignments from University), due to academic integrity. I felt that there was some flexibility to the very last assignment of this course that it would be very obvious to anyone if students plagarized my solution. The last assignment is about creating an assembler to translate Hack Assembly to Hack Machine Code but there are two options for students to complete the assignment. The first method is to have students program an assembler in any language of their choice, and the other option is to have students manually translate assembly to machine code by hand to compensate for students who may not have much programming knowledge.

This leads to a lot of possible solutions compare to the previous assignments where there is only so many ways to answer them in a somewhat acceptable manner. I have decided to use C as my language of choice to create the assembler because a lot of assemblers that were written in high leve languages are actually written in C (from what I know). Writting an assembler in Java (the recommended way in the course), Python, or in Perl is probably a much "easier" way to write an assembler and is perhaps the main languages students use to implement the assembler. However, I want to first tackle this assignment in C to practice my C programming skills. Perhaps I'll also implement the Hack Assembler in other languages such as C++, Perl and Rust as the complexity and size is just right to refresh or learn the language in a decent enough depth.

The first version of this implementation will not be written as efficiently as I would have wanted it to be due to laziness. For instance, the current plan is to have a linkedlist to store the symbol table rather than using a Hash Table so searching in the table would be O(n). I chose to implement the symbol table in my first version of the assembler using Linkedlist simply because it's easy to write and it's better than writting it using an array since the size is not known so trying to expand the array could potentially increase runtime since memory may need to be copied to a new location

Note: If the instructors of this course disagrees with my view of publishing my implemention of the assembler online, feel free to contact me to take it down.

hackassembler's People

Contributors

zakuarbor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.