Syntax analysis and code generation

Assignment Help Computer Engineering
Reference no: EM132314035

Assignment - Jack Compiler

Project Description

In this assignment you will complete a variation of projects 10 and 11 in the nand2tetris course, reworked descriptions of Nand2Tetris Projects 10 and 11 are shown below. In particular, you will write the following programs that are used to implement different components of an optimising Jack compiler that compiles a Jack class into Hack Virtual Machine (VM) code:
parser - this parses a Jack program and constructs an abstract syntax tree.
codegen - this takes an abstract syntax tree and outputs equivalent VM code.
pretty - this takes an abstract syntax tree and produces a carefully formatted Jack program.
optimiser-r - this copies an abstract syntax tree and removes redundant code.

SVN Repository

You must create a directory in your svn repository named: <year>/<semester>/cs/assignment3. This directory must only contain the following files and directories - the web submission system will check this:
Makefile - this file is used by make to compile your submission - do not modify this file.
.cpp C++ source files - naming as specified in the component program requirements.
.h C++ include files - naming as specified in the component program requirements.
lib - this directory contains precompiled programs and components - do not modify this directory. includes - this directory contains .h files for precompiled classes - do not modify this directory. tests - this directory contains a test script and test data, you can add your own tests too.

Your programs must be written in C++ and will be tested using Jack language programs that that may or may not be syntactically correct and previously generated abstract syntax trees. Although a wide range of tests may be run, including some secret tests, marks will only be recorded for those tests that require a working parser program. Your programs will be compiled using the Makefile and precompiled components in the lib directory. Note: you will get no feedback on the secret tests, even if you ask!

Automatic Marking

The automatic marking will compile and test both of your tokenisers 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!

The marks from the automatic tests for each component program will be weighted as follows:

parser - 30%
codegen - 40%
pretty - 10%
optimiser-r - 20%

The test scripts are able to test each component program independently but, we strongly suggest that you attempt the component programs in the order above so that you get the most return on your effort.
You should gain the most significant learning benefit from completing both the
parser and codegen programs.

Nand2Tetris Projects 10 & 11: Compiler I & II

Background

Modern compilers, like those of Java and C#, are multi-tiered: the compiler's front-end translates from the high-level language to an intermediate VM language; the compiler's back-end translates further from the VM language to the native code of the host platform. In an earlier workshop we started building the back- end tier of the Jack Compiler (we called it the VM Translator); we now turn to construct the compiler's front-end. This construction will span two parts: syntax analysis and code generation.

Objective
In this project we build a Syntax Analyser that parses Jack programs according to the Jack grammar, producing an abstract syntax tree that captures the program's structure. We then have a choice, we can morph the logic that generates the abstract syntax tree into logic that generates VM code or we can write separate logic that can apply any number of transformations to our abstract syntax tree. The transformations may include pretty printing the original program, applying specific optimisations to the abstract syntax tree or generating VM code. This mirrors the alternative approaches used in the workshops.

Attachment:- Computer Systems.rar

Reference no: EM132314035

Questions Cloud

Organization operate as socially responsible organization : Examine the manner in which your company's Supplier Code of Conduct helps the organization operate as a socially responsible organization.
Write a financial settlement system for a smartcard : 31253 - Database Programming - University of Technology Sydney - Write Financial Settlement System for a Smartcard Transaction Centre
Discuss the impact of employment law on organization policy : Discuss the impact of employment law on an organization's policy on equal employment opportunity. Evaluate performance-based review processes.
Organization operate as socially responsible organization : Examine the manner in which your company's Supplier Code of Conduct helps the organization operate as a socially responsible organization.
Syntax analysis and code generation : Implement different components of an optimising Jack compiler that compiles a Jack class into Hack Virtual Machine - create a directory in your svn repository
What ethical and information security issues : What ethical and information security issues can arise when conducting E-business?
Change management in the project management processes : Discuss the need for change management in the project management processes. How can the application of change management principles impact project as a whole?
Define the five conflict management styles : List and explain the three parts of the message-receiving process. Define the five conflict management styles. Discuss the main criticisms of LMX Theory.
Becoming a professional early childhood teacher : EC501 - Becoming a professional Early Childhood Teacher - New Zealand Tertiary College - Prepare a paper on Becoming a professional Early Childhood Teacher

Reviews

len2314035

5/30/2019 3:13:12 AM

Marks for this assignment contribute 10% of the overall course mark. Marks for functionality will be awarded automatically by the web submission system. Due dates: Milestone - 11:55pm Friday of week 11, Final - 11:55pm Friday of week 12. Late penalties: For each part, the maximum mark awarded will be reduced by 25% per day / part day late. If your mark is greater than the maximum, it will be reduced to the maximum. Core Body of Knowledge (CBOK) Areas: abstraction, design, hardware and software, data and information, and programming.

Write a Review

Computer Engineering Questions & Answers

  Develop a complete disaster recovery plan to your company

Using an organization of your choice: Develop a Complete Disaster Recovery Plan to be submitted to the executive board of your company.

  Write a heap method named incrementpriority

Write a Heap method named incrementPriority that, given the position of an element in the array just described, adds 1 to its value and reorganizes the heap.

  What signal encoding cables and connectors are used

What signal encoding, cables, and connectors are used? Is the channel serial or parallel? Is transmission synchronous or asynchronous?

  Discuss the key component of technical communication

When discussing technical and business communications, we generally think of memos, email, presentations, and the like. We do not always immediately think.

  Display all of the purchases to the customer

Accept the dollar value of each item purchased from the user until the user is finished.

  Perform the steps of abstraction and refinement on them

Bees shall spawn from the hive when the user interacts with the hive. Bees shall be able to move from the hive to a flower.

  How many gate delays are there in the longest path

How many gate delays are there in the longest path from some input to some out-put of a 64-bit adder using 4-bit carry lookahead groups and a multiple level str

  What is the current cybersecurity-related situation

What is the current cybersecurity-related situation involving the Virtual Realty? What do you predict will happen in the future regarding Virtual Realty?

  Write routine to visualize a two-dimensional vector data set

Write a routine to visualize a two-dimensional, vector data set using an arrow representation for the vector values.

  Write a recursive function that prints the number in a range

Write a recursive function that determines whether an array is a palindrome, where the array and its size are given as parameters.

  Write a program to calculate average of all scores entered

Write a program to calculate the average of all scores entered between 0 and 100. Use a sentinel-controlled loop variable to terminate the loop.

  Utilize routers for connectivity devices instead of hubs

Utilize routers for connectivity devices instead of hubs

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd