Jack Compiler

ssignment 3- Jack Compiler
Weightingand Due Dates
Marks for this assignment contribute 15% 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.
Project Description
In this assignment you will complete a variation of projects 10 and 11 in the nand2tetris course, reworked descriptions ofNand2Tetris Projects 10 and 11are shown below. In particular, you will write the following programs that are used to implement different components of an optimising Jack compiler that compiles aJack class into Hack Virtual Machine (VM) code:
parser- this parsesaJack program and constructs an abstract syntaxtree.
codegen- this takesan abstract syntaxtreeandoutputsequivalentVM code.
pretty- this takes an abstract syntaxtree and produces acarefully formatted Jack program.
optimiser-e*-this copiesan abstract syntaxtreeand pre-evaluates expressions where possible.
optimiser-r^-this copiesan abstract syntaxtreeandremovesredundant code.
SVN Repository
You must create a directory in your svn repository named:<year>/<semester>/cs/assignment3. This directory may only contain the following files and sub-directories- theweb submission systemwill check this:
Makefile- this file is used bymaketo compile your submission -do not modifythis file.
.cppC++ source files - naming as specified below.
.hC++ include files- naming as specified below.
lib- this directory contains precompiled programs and components -do not modify this directory.
includes- this directory contains.hfiles for precompiled classes-do not modify thisdirectory.
tests- this directory contains a test script and test data, you can add your own tests too.
parser- your implementation of theparserprogram.
codegen- a script to run yourcodegenprogram.
pretty- a script to run yourprettyprogram.
optimiser-e- a script to run youroptimiser-eprogram*.
optimiser-r- a script to run youroptimiser-rprogram^.
Notes:
if thelib/*/lib.afiles do not get added to your svn repository you will need explicitly add them and make another commit:
% svn add lib/*/lib.a
% svn commit -m adding-missing-libraries
if the real executable programs are added to your svn repository you will need to explicitly remove them and make another commit:
% svn rm lib/*/parser lib/*/codegen lib/*/pretty lib/*/optimiser-e lib/*/optimiser-r
% svn commit -m removing-executables
Notes:
*Only for students enrolled in the undergraduate offering, COMP SCI 2000.
^Only for students enrolled in the postgraduate offering, COMP SCI 7081.
Submission and Marking Scheme
This assignment has three assignments in theweb submission systemnamed:Assignment 3- Milestone Submissions,Assignment 3- Final Submissions - UGandAssignment 3- Final Submissions - PG. The assessment is based on "Assessment of Programming Assignments". A submission to any of these assignments in theweb submission systemwill automatically result in a submission to the other assignments. This is to ensure that a submission to the wrong assignment does not result in an accidental loss of marks.
Assignment 3- Milestone Submissions: due 11:55pm Friday of week 11
The marks awarded by theweb submission systemforAssignment 3- Milestone Submissionscontribute up to 20% of your marks for assignment 3.Yourmilestone submission mark, after the application of late penalties, will be posted to the myuni gradebook when the assignment marking is complete.
Your program must be written in C++and itwill be compiled using theMakefileand precompiled componentsin thelibdirectory. It will be tested using Jack language programsthat may or may not be syntactically correct. Awide range of tests may be run, including somesecrettests.Marks will only be awarded for tests requiring a workingparserprogram.Note: you will get no feedback on thesecrettests, even if you ask!
Assignment 3 - Final Submissions: due 11:55pm Friday of week 12
Yourfinal submission mark will be the geometric mean of the weighted marks awarded by theweb submission systemfor eitherAssignment 3- Final Submissions - UGorAssignment 3- Final Submissions - PG,a mark for your logbook and a mark for your code. It will be limited to 20% more than themarks awarded by theweb submission system. See"Assessment - Mark Calculations"for examples of how the marks are combined. Yourfinal submission mark, after the application of late penalties, will be posted to the myuni gradebook when the assignment marking is complete.
Your program must be written in C++and itwill be compiled using theMakefileand precompiled componentsin thelibdirectory. It will be tested using Jack language programsthat may or may not be syntactically correct. Awide range of tests may be run, including somesecrettests.Note: you will get no feedback on thesecrettests, even if you ask!
Automatic Marking
The final submission marks awarded by theweb submission systemforeach component program will be weighted as follows:
For students enrolled inCOMP SCI 2000 Computer Systems:
Assignment 3- Final Submissions - UG
parser- 30%
codegen- 40%
pretty- 10%
optimiser-e- 20%
For students enrolled inCOMP SCI 7081 Computer Systems:
Assignment 3- Final Submissions - PG
parser- 30%
codegen- 40%
pretty- 10%
optimiser-r- 20%
Logbook Marking
Important: the logbook must have entries for all work in this assignment, including your milestone submissions and all of the component programs. All the logbook links in theweb submission systemassignments for Assignment 3 point to the sameshared logbook. See "Assessment - Logbook Review" for details of how your logbook will be assessed.
Code Review Marking
For each of your programming assignments you are expected to submit well writtencode.See "Assessment - Code Review" for details of how your code will be assessed.
Assignment 3- Participation Marks
Any submissions to the final submissions assignment made more than two weeks before but less than three weeks before the due date for the final submissions assignment, may be awarded participation marks. The participation marks will be calculated by scaling the best mark awarded by the automatic marking of an eligible submission during this week to be a number between 0 and 10.
Any submissions to the final submissions assignment made more than one week before but less than two weeks before the due date for the final submissions assignment, may be awarded participation marks. The participation marks will be calculated by scaling the best mark awarded by the automatic marking of an eligible submission during this week to be a number between 0 and 10.
A maximum of 20 participation marks are available.
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 the construction of 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

代写Jack Compiler作业, 代写Nand2Tetris project  thenwrite separate logic that can apply any number of transformations to ourabstract syntax tree. The transformations may include pretty printing the original program, applying specific optimisations to theabstract syntax treeor generating VM code. This mirrors the approaches usedin the workshops.

Resources
The relevant reading for this project is Chapters 10 and 11. However, you should follow the program structure used in earlier workshops rather than the proposed structure in Chapters 10 and 11.You must write your programs in C++.You should use the Linux commanddiffto compare your program outputs to the example output files supplied by us. A 代代写
Hack Virtual Machine set of precompiled classes similar to those used in the workshops and the previous assignment are in the zip file attached below. All the test files and test scripts necessary for this project are available in the zip file attached below.

Testing and IO
We have a provided a description of the requirements for each component program on its own page. This includes instructions on how to compile, run and test each component program. However before starting work on any of the component programs you should review the pages on Testing and IO Controls.
Testing
The test data including the convention used to name expected outputs for each test are described on theAssignment 3 | testingpage.
IO Controls
Each component program has specific requirements for what it should or should not output when it is working correctly and what to do when an error occurs. Unfortunately, this can make it difficult to trace the execution of your programs and get meaningful error messages from them during development. To allow you to achieve both, a number of output buffering and error reporting functions have been provided and are described on theAssignment 3 | io controlspage.
Component Programs
parser
Theparserprogram uses the provided tokeniser to parse a Jack program and construct an equivalent abstract syntaxtree. The specific requirements for this component program are described on theAssignment 3 | parserpage.
codegen
Thecodegenprogram traverses anabstract syntaxtreeto generate virtual machine code. The specific requirements for this component program are describedon theAssignment 3 | codegenpage.
pretty
Theprettyprogram traverses an abstract syntaxtree produced and prints a Jack program formatted to a specific coding standard.The specific requirements for this component program are describedon theAssignment 3 | prettypage.
optimiser-e*
Theoptimiser-eprogram traverses anabstract syntaxtreeproduced andgenerates a new abstract syntax tree with all expressions pre-evaluated if possible.The specific requirements for this component program are describedon theAssignment 3 | optimiser_epage.
optimiser-r^
Theoptimiser-rprogram traverses anabstract syntaxtreeproduced andgenerates a new abstract syntax tree with redundant program elements removed.The specific requirements for this component program are describedon theAssignment 3 | optimiser_rpage.
Startup Files
The startup files should work on most 64-bit Linux systems and on a Mac. Please see theStartup Files for Workshops and Assignmentspage for more information.
assignment-compiler.zip

因为专业,所以值得信赖。如有需要,请加QQ:99515681或邮箱:[email protected]

微信:codehelp

猜你喜欢

转载自www.cnblogs.com/jCompiler/p/11689812.html