This assignment makes use of the files contained in this zip file. This assignment is due Tuesday, February 11.
This assignment is based on Language_3. This is not a difficult assignment. It is meant to help you familiarize yourself with the interpreter code for Language_3
In the zip file there is a file Language_3a.txt
that describes a new language called Language_3a. Language_3a adds four new operators to Language_3. Your assignment is to add code to the interpreter for Language_3 so that the new interpreter can handle the new operators.
In the zip file there is the file Evaluate_3a.java
. As distributed, this file is the interpreter for Language_3. Modify this file so that it handles the four new operators described in Language_3a.txt
.
Also in the zip file there is the file AST2infix_3a.java
. As distributed, this file converts Language_3 into infix form. Modify this file so that it handles the four new operators. The infix notation for these operators should be exactly like their C/C++/Java counterparts.
In the zip file there is a prettyprinter for trees, PrettyPrinter.java
. But this prettyprinter is very verbose. Write a prettyprinter, called PrettyPrinter2.java
, that does the following.
In the zip file there is an example output file for Language_3, Language_3_Examples_output.txt
. Look at that file to get a good idea of what the prettyprinter should produce.
When you have finished implementing Evaluate_3a.java
, AST2infix_3a.java
, and PrettyPrinter2.java
, then the file Language_3a_Examples.java
should compile and run. The output from running this program should look exactly like the file Language_3a_Examples_output.txt
. Also, make sure that you didn't break anything from Language_3. The program Language_3_Examples.java
from the zip file should also compile and run correctly and the program's output should look exactly like the file Language_3_Examples_output.txt
(every Language_3 expression is also a valid Language_3a expression).
Turn in a zip file called CS502Hw2Surname.zip
(where Surname
is your last name) containing your versions of Evaluate_3a.java
, AST2infix_3a.java
, and PrettyPrinter2.java
(just those files).
This assignment is due Tuesday, February 11.