[SOLVED] XML compiler 20191030 Assignment 3 testing: Computer Systems 20007081 Combined

$25

File Name: XML_compiler_20191030_Assignment_3__testing:_Computer_Systems_20007081_Combined.zip
File Size: 744.18 KB

5/5 - (1 vote)

20191030 Assignment 3testing: Computer Systems 20007081 Combined
Assignment 3testing
A natural way to test the components of a Jack compiler it is to see how they handle some representative Jack programs. We have included a number of Jack programs from the nand2tetris files together with a number of our own smaller examples.
Details of how to run the tests for each component program are described on their individual pages. Common to each, there is a test script in the bin directory that runs a selection of relevant tests for each program and displays the commands being used along with a passed or failed message. To allow you to implement your component programs in any order, the test scripts will use working versions of the component programs not being tested. You can copypaste the command pipeline between the double quotes to see the actual output of each test. This will allow you to run specific tests and see any debug messages you may have added to your code to help you discover the source of any problems. No debug messages must be output by your work submitted for assessment.
All the test files provided are named using the following conventions.
There is one subdirectory per Jack program that contains all the Jack classes required by that program.
The source code for a Jack class is in a file with the extension .jack.
Every program used to generate a file is encoded in a list of filename extensions in the order applied.
Example Test Files
A file with the name Main.jack.parser.optr.codegen.Cvm should contain VM code. It was produced by a command like:
cat Main.jack.parser.optimiserr.codegenMain.jack.parser.optr.codegen.Cvm
A file with the name Main.jack.parser.optr.Pxml should contain Jack source code. It was produced by a command like:
cat Main.jack.jparser.optimiserrMain.jack.parser.optr.Pxml
A file with the name Main.jack.parser.Pxml should contain an XML representation of an abstract syntax tree, with newlines and indentation to make it easier to read. It was produced by a command like:
cat Main.jack.parserMain.jack.parser.Pxml
The last filename extension in a name indicates the file contents:
Extension
Description
.jack
Jack source code
.Pjack
pretty printed Jack source code
.Pxml
an abstract syntax tree encoded as pretty printed xml
.Cvm
Hack Virtual Machine code
.empty
an empty file
https:myuni.adelaide.edu.aucourses44936pagesassignment37Ctesting 12

20191030 Assignment 3testing: Computer Systems 20007081 Combined
Writing Your Own Tests
If you wish to write your own test, create a .jack file in a subdirectory of the tests directory, then run the command:
make testnew
This will regenerate the test output files for every .jack file that is in a subdirectory of the tests directory. Your new test will then be automatically included with all of the other tests. There is no need to have one directory per program, all tests are run against a specific .jack source file. Also, there is no requirement for a class name to match the filename because the jackparser function is not provided with the filename.
You can also construct your own command pipelines to try different ways of testing your programs. For example, you could pretty print the output of an optimiser as Jack code, or run the optimiser over its own output, or run the parser over the output of the pretty printer. Here is an example of pretty printing optimiser output.
cat Main.jack.parser.optimiserr.prettyPrettier.jack
This might transform:
class Mainfunction void mainvar int a;let a1;return;let a2;
into:
class Main
function void main

var int a ;
let a1 ;
return ;

The following command should also perform the same transformation:
cat Main.jack.parser.optimiserr.pretty.parser.optimiserr.prettyPrettier.jack
Testing Everything
If you want to run all of the tests at once, you can use the command:
make test
If you want to run all of the tests at once using working versions of the component programs, you can use the command:
make testworking
https:myuni.adelaide.edu.aucourses44936pagesassignment37Ctesting 22

Reviews

There are no reviews yet.

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

Shopping Cart
[SOLVED] XML compiler 20191030 Assignment 3 testing: Computer Systems 20007081 Combined
$25