5/12/2019 Assignment 3 Description: Computer Systems (2000_7081 Combined) https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-description 1/4 Assignment 3 Description Assignment 3 - Jack...

1 answer below »
C++ programming WITH LOGBOOK


5/12/2019 Assignment 3 Description: Computer Systems (2000_7081 Combined) https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-description 1/4 Assignment 3 Description Assignment 3 - Jack Compiler Weighting and Due Dates 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. 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: //cs/assignment3. This directory must only contain the following files and directories - the web submission system (https://cs.adelaide.edu.au/services/websubmission) 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. Note: if the file lib/lib.a does not get added to your svn repository you will need explicitly add it using: % svn add lib/lib.a Submission and Marking Scheme https://cs.adelaide.edu.au/services/websubmission 5/12/2019 Assignment 3 Description: Computer Systems (2000_7081 Combined) https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-description 2/4 This assignment has two assignments in the web submission system (https://cs.adelaide.edu.au/services/websubmission) named: Assignment 3 - Milestone Submissions and Assignment 3 - Final Submissions. The assessment is based on "Assessment of Programming Assignments (https://myuni.adelaide.edu.au/courses/44935/pages/assessment-of-programming- assignments) ". Assignment 3 - Milestone Submissions: due 11:55pm Friday of week 11 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 3. 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 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! Assignment 3 - Final Submissions: due 11:55pm Friday of week 12 The marks awarded for the final submission contribute up to 80% of your marks for assignment 3. Your final submission mark will be the geometric mean of the marks awarded by the web submission system (https://cs.adelaide.edu.au/services/websubmission/) , a mark for your logbook and a mark for your code. It will be limited to 20% more than the marks awarded by the web submission system (https://cs.adelaide.edu.au/services/websubmission) . See "Assessment - Mark Calculations (https://myuni.adelaide.edu.au/courses/44935/pages/assessment-mark-calculations) " for examples of how the marks are combined. Your final submission mark, after the application of late penalties, will be posted to the myuni gradebook when the assignment marking is complete. 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. https://cs.adelaide.edu.au/services/websubmission https://myuni.adelaide.edu.au/courses/44935/pages/assessment-of-programming-assignments https://cs.adelaide.edu.au/services/websubmission https://cs.adelaide.edu.au/services/websubmission/ https://cs.adelaide.edu.au/services/websubmission https://myuni.adelaide.edu.au/courses/44935/pages/assessment-mark-calculations 5/12/2019 Assignment 3 Description: Computer Systems (2000_7081 Combined) https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-description 3/4 Logbook Marking Important: the logbook must have entries for all work in this assignment, including your milestone submissions. See "Assessment - Logbook Review (https://myuni.adelaide.edu.au/courses/44935/pages/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 written code. See "Assessment - Code Review (https://myuni.adelaide.edu.au/courses/44935/pages/assessment-code- review) " for details of how your code will be assessed. 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. 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 command diff to compare your program outputs to the example output files supplied by us. A 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. Component Functions 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. parser The parser program uses the provided tokeniser to parse a Jack program and construct an equivalent abstract syntax tree. The specific requirements for this component program are described on the jack_parser (https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-jack-parser) page. https://myuni.adelaide.edu.au/courses/44935/pages/assessment-logbook-review https://myuni.adelaide.edu.au/courses/44935/pages/assessment-code-review https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-jack-parser 5/12/2019 Assignment 3 Description: Computer Systems (2000_7081 Combined) https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-description 4/4 codegen The codegen program traverses an abstract syntax tree to generate virtual machine code. The specific requirements for this component program are described on the jack_codegen (https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-jack-codegen) page. pretty The pretty program traverses an abstract syntax tree produced and prints a Jack program formatted to a specific coding standard. The specific requirements for this component program are described on the jack_pretty (https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-jack-pretty) page. optimiser-r The optimiser-r program traverses an abstract syntax tree produced and generates a new abstract syntax tree with redundant program elements removed. The specific requirements for this component program are described on the jack_optimiser_r (https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-jack-optimiser-r) page. Testing The test data including the convention used to name expected outputs for each test are described on the Testing (https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-testing) page. Startup Files Compiled using g++ 4.8.5 for CAT Suite Linux, Web Submission and Docker image csadelaide/cscli: assignment-compiler-cats.zip (https://myuni.adelaide.edu.au/courses/44935/files/4571385/download? wrap=1) Compiled using g++ 7.3.0 on Ubuntu 18.04 for other Linux: assignment-compiler-linux.zip (https://myuni.adelaide.edu.au/courses/44935/files/4571384/download? wrap=1) Compiled using X-Code for MacOS High Sierra (10.13): assignment-compiler-macos.zip (https://myuni.adelaide.edu.au/courses/44935/files/4571382/download?wrap=1) https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-jack-codegen https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-jack-pretty https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-jack-optimiser-r https://myuni.adelaide.edu.au/courses/44935/pages/assignment-3-testing https://myuni.adelaide.edu.au/courses/44935/files/4571385/download?wrap=1 https://myuni.adelaide.edu.au/courses/44935/files/4571384/download?wrap=1 https://myuni.adelaide.edu.au/courses/44935/files/4571382/download?wrap=1 School of Computer Science | Web Submission 16/05/2016, 1:01 PMSchool of Computer Science | Web Submission Page 1 of 3https://cs.adelaide.edu.au/services/logbooks/?sub_year=2016&sub…od=s1&sub_course=cs&sub_assign=workshop08&sub_alt_user=a1002160 You are here: Computer Science > Student Logbooks > services> logbooks Log book for user: a1002160 for assignment: 2016/s1/cs/workshop08 Log book entries - oldest entries first Reload Page Read Only Reload Page Read Write Datestamp Entry 16 May 2016 09:46:10 by: a1002160 from: 129_127_10_168 kind: Text Initialised logbook. 16 May 2016 09:48:39 by: a1002160 from: 129_127_10_168 kind: Text Started reading the workshop description. I will setup the svn directory first, copy the provided files into it and do a first commit. 16 May 2016 09:52:48 by: a1002160 from: ?_?_?_? kind: SVN Log Entry r1840 | a1002160 | 2016-05-16 09:52:48 +0930 (Mon, 16 May 2016) | 1 line Changed paths: A /2016/s1/cs/workshop-08 16S1-CS-W8 16 May 2016 09:55:05 by: a1002160 from: 129_127_10_168 kind: Text Downloading the files didn't quite work - trying to use save as to download them directly into the working copy just left me with the html for the login page? I had to download by clicking on each file then copying them into the working directory. 16 May 2016 10:06:26 by: a1002160 from: 129_127_10_168 kind: Text I read the sources and looked up the XML syntax. It looks like we just need to complete the vmtokens.cpp file to get the first part of the workshop working. 16 May 2016 10:11:05 by: a1002160 from: 129_127_10_168 kind: Text It looks like every valid token starts with a letter or digit so I think I will use isalnum(3) to look the start of a token. I also need to check for end of input, the comments suggest using cin.get() because that returns a special value EOF which is not a legal character when we fall off the end of the input. 16 May 2016 10:14:41 by: a1002160
Answered 284 days AfterMay 12, 2021

Answer To: 5/12/2019 Assignment 3 Description: Computer Systems (2000_7081 Combined)...

Karthi answered on Feb 20 2022
119 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here