In this assignment, the assembler will be written as two separate programs. the executable program, parser, will read a Hack Assembly Language program from standard inputC++ Programming

Project Description

In this assignment you will complete a variety of project 6 in the nand2tetris course. A detailed description of Nand2Tetris Project 6 tailored to this course is shown below. In this assignment, the assembler will be written as two separate programs. The executable program, parser, will read a Hack Assembly Language program from standard input and produce an abstract syntax tree on standard output. The executable program, translator, will read the abstract syntax tree and assemble a machine code representation of the original Hack Assembly Language program. The assembled code will be formatted as sixteen zeros or ones per line and it will be written to standard output.

Makefile - this file is used by make to compile your programs - do not modify this file. parser.cpp - C++ source file

translator.cpp - C++ source file

my*.cpp C++ source files with names that start with my my*.h C++ include files with names that start with my

bin - this directory contains precompiled programs and scripts - do not modify this directory. lib - this directory contains precompiled components - do not modify this directory.

includes - this directory contains .h files for precompiled classes - do not modify this directory. tests - this directory contains test data, you can add your own tests here

Assignment 2 - Milestone Submissions: due 11:55pm Tuesday of week 9

The marks awarded by the web submission system (https://cs.adelaide.edu.au/services/websubmission) for the milestone submission contribute up to 20% of your marks for assignment 2. Your milestone submission mark, after the application of late penalties, will be posted to the myuni gradebook when the assignment marking is complete.

Your programs must be written in C++ and will be tested using Hack Assembly Language programs  that that may or may not be syntactically correct. Although a wide range of tests may be run, including a number of secret tests, marks will only be recorded for those tests that are syntactically correct and do  not use symbols. Your programs will be compiled using the Makefile included in the zip file attached below. The parser program will be compiled using the file parser.cpp and the translator program will be compiled using the file translator.cpp file. In both cases any .cpp files with names starting with my will   be also included together with the precompiled library functions.

Automafic Marking

The automatic marking will compile and test both of your programs in exactly the same way as for the milestone submission. The difference is that marks will be recorded for all of the tests including

the secret tests. Note: if your programs fail any of these secret tests you will not receive any feedback about these secret tests, even if you ask

Nand2Tetris Project 6: The Assembler

Background

Low-level machine programs are rarely written by humans. Typically, they are generated by compilers. Yet humans can inspect the translated code and learn important lessons about how to write their high- level programs better, in a way that avoids low-level pitfalls and exploits the underlying hardware better. One of the key players in this translation process is the assembler -- a program designed to translate code written in a symbolic machine language into code written in binary machine language.

This project marks an exciting landmark in our Nand to Tetris odyssey: it deals with building the first rung up the software hierarchy, which will eventually end up in the construction of a compiler for Java/C++ like high-level language. The relevant reading for this project is Chapter 6. Some of the useful tools available include, the Hack Assembler, the CPU Emulator and working versions of the two programs, bin/parser and bin/translator.

Objective

The Hack assembler is a relatively simple program however, so that you can gain experience with the tools used in other workshops and assignments, you will build your assembler from three parts. This will involve using a precompiled tokenizer for the Hack assembly language to implement a parser that recognizes labels, A-instructions and C-instructions using tokens returned by the tokenizer. The parser will construct a tree representation of the program that the translator will walk over in order to assemble the final machine code If you wish to create additional source files that can be used by your programs the .cpp and .h files must have names that start with mine. All my*.cpp files will be compiled as part of both you parser and translator programs.

Attachments:

Instructions Files

C++ Programming Experts

expert
Dinh Hong P.
C++ Programming

20 Answers

expert
Eric Bell
C++ Programming

88 Answers

View More Experts
Disclaimer

The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.

Get Free Quote!

267 Experts Online