Engineering Homework Help

Engineering Homework Help. Simple Pascal interpreter

Simple Pascal interpreter
The purpose of this assignment is to give you practice writing a parser and an interpreter
for simplified Pascal. You can start this assignment with your solution to Assignment #2,
or you can use Asgn02Cpp.zip.
Modify the frontend parser to include the WHILE, FOR, IF, and CASE statements of the
simplified Pascal. Use the syntax diagrams and the parse trees shown in the lecture
notes. Then modify the interpreter’s backend executor to execute those statements.
Make any necessary modifications to the other classes. For example, you may need to
add more parse tree node types.
Suggested order
Here is a suggested order to implement the additional statements:
1. WHILE statement. It’s similar to the REPEAT statement.
2. IF statement. Handle statements with and without an ELSE part. Be sure to
handle a “dangling else” correctly.
3. FOR statement. It’s a more elaborate parse tree, so build it carefully according to
the parse tree in the lecture notes.
4. CASE statement. The most elaborate parse tree. Build it very carefully according
to the parse tree in the lecture notes.
For each statement, first make sure your parse tree is correct by visually inspecting the
tree that the -parse option prints. Then work on executing the statemenT

est input files
Here are test input files that you should run for each of the statements and the expected
runtime output. You may want to create your own simpler tests before trying these. In
particular, TestIf.txt has some complicated expressions that will require
modifications to the expression parser and executor. Click on the links to download the
files.
You can use the online Pascal compilers to verify the output of the test files. But you’ll
need to add variable declarations to turn them into valid Pascal programs.

Engineering Homework Help

 
"Our Prices Start at $11.99. As Our First Client, Use Coupon Code GET15 to claim 15% Discount This Month!!"