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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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