[SOLVED] 代写 XML 20191030 Assignment 3 pretty: Computer Systems 20007081 Combined

30 $

File Name: 代写_XML_20191030_Assignment_3__pretty:_Computer_Systems_20007081_Combined.zip
File Size: 715.92 KB

SKU: 7234183156 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


20191030 Assignment 3pretty: Computer Systems 20007081 Combined
Assignment 3pretty
Description
You must complete the implementation of the pretty program in the file pretty.cpp.
The program reads an XML representation of an abstract syntax tree of a Jack class from standard input and writes the equivalent Jack source code to standard output formatted to a specific coding standard.
It uses the functions described in abstractsyntaxtree.h to traverse an abstract syntax tree and the functions in iobuffer.h to write Jack source code to standard output. The main function is responsible for calling the astparsexml function and passing the result to the jackpretty function. The astparsexml function is responsible for reading an XML representation of the abstract syntax tree from standard input. All output must be written using the writetooutput function described in iobuffer.h.
Compiling and Running pretty
When the Makefile attempts to compile the program pretty, it will use the file pretty.cpp, any other
.cpp files it can find whose names start pretty. For example, if we have our own class abc that we want to use when implementing pretty, we would name the extra files, prettyabc.cpp and prettyabc.h.
The program can be compiled using the command:
make pretty
The suite of provided tests can be run using the command:
make testpretty
The test scripts do not show the program outputs, just passed or failed, but they do show you the commands being used to run each test. You can copypaste these commands if you want to run a particular test yourself and see all of the output.
Note: Do not modify the provided Makefile or the subdirectories bin, includes or lib. These will be replaced during testing by the web submission system.
jackpretty
Not every program is laid out to suit individual taste and some programming styles may be difficult for others to read. The purpose of the jackpretty function is to take an abstract syntax tree for a Jack class and output the equivalent Jack source code using a consistent set of coding standard rules.
Since you need to be able to walk over every node of an abstract syntax tree representing a Jack class, we have provided a skeleton of the tree walking functions required in the pretty.cpp file. This should save you a lot of typing. However, you do not need to follow this structure if you do not want to.
The specific formatting rules that the jackpretty function must implement are as follows: The indentation level starts at 0.
https:myuni.adelaide.edu.aucourses44936pagesassignment37Cpretty 12

20191030 Assignment 3pretty: Computer Systems 20007081 Combined
When a line is output, it must start with 4 spaces for each level of indentation.
Left curly bracketsmust be on their own line and the level of indentation is incremented after the line is output.
Right curly bracketsmust be on their own line and the level of indentation count is decremented before the line is output
If a subroutine contains local variable declarations, there must be an empty line after the last variable declaration.
All static, field and local variable declarations must be displayed one variable per line, in their order in the abstract syntax tree.
If a class contains subroutine declarations and either static or field variable declarations, there must be an empty line after the last variable declaration.
All subroutine declarations in a class, except the last, must be followed by an empty line.
Every if statement and while statement must be followed by a blank line unless they are immediately followed by .
Unless otherwise noted, all tokens within a line must be separated by a single space character.
The must be no whitespace characters after the last token on a line.
Commas , and dots . do not have any white space before or after them.
Left round bracketsdo not have any white space before them unless the previous token
is if, while, , or an infix operator.
Left round bracketsdo not have any white space after them.
Right round bracketsdo not have any white space before them.
Unary operators do not have whitespace after them.
Unary operators do not have whitespace before them unless the previous token is , or an infix operator.
Integer constant values should all be in the range 0 to 32,767. However, the astint node will accept any value in the range 32,768 to 32,767. Where a negative value is found, the value must be represented by a negation within brackets. For example, 11,432 would be represented by11432. No sign is used for nonnegative integers. In the special case of 32,768, the value must be represented by the expression 1638416384.
Semicolons ; always terminate a line.
A new line of output can only start if required by a previous rule.
The example outputs for the pretty program are named .Pjack. Notes:
Do not modify the main function in pretty.cpp.
All output must be written using the writetooutput function in includesiobuffer.h.
https:myuni.adelaide.edu.aucourses44936pagesassignment37Cpretty 22

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 代写 XML 20191030 Assignment 3 pretty: Computer Systems 20007081 Combined
30 $