Add control statements, block statements and empty statements to your compiler for the T programming language. The control statements to be added are the if-then-else, while, return, break and continue statements.
First, you should fix all bugs in your Phase 1 compiler. Testing (and grading) your Phase 2 submission will depend on the Phase 1 functionality. The test files used for grading Phase 1 will be available in ~cs712/public/tests/phase1/grading after the final date to submit Phase 1 has passed.
You will need to upgrade your scanner to add support for the new keywords required by the control statements.
You will need to upgrade your parser to add the necessary productions for the control, block and empty statements and to build AST nodes for these constructs. See the file ~cs712/public/phase2.y for the productions of the T grammar that you need to add for this phase.
You will need to upgrade your semantic analysis routines to properly handle the new AST nodes that represent the control, block and empty statements. Be sure to detect the necessary semantic errors and issue appropriate messages to stderr.
Finally, you will need to upgrade your code generator to generate code for the control, block and empty statements. See the file ~cs712/public/phase2.intel for the code generation patterns for this phase.
There are a few T test programs for this phase in the directory ~cs712/public/tests/phase2.
Your compiler should maintain all the behavior mandated by the Phase 1 specification, regarding command-line switches, AST dump format, Makefile goals, README file, etc.
As you did for Phase 1, archive all your files in a tar file called "src.tar". This tar file should un-tar into a single directory called "src", which should contain the Makefile, the README file, the "RTS.c" file and all the source files. All submitted files should be placed directly in the top-level of this directory. (That is, please do not use subdirectories.) You should submit your tar archive from agate.cs.unh.edu using my "submit" script. Please note: the tar file you submit should not be compressed. But, please, do not include any executable or object files in the tar file.
To turn in this assignment, type:
~cs712/bin/submit phase2 src.tar
Submissions can be checked by typing (also on agate.cs.unh.edu):
~cs712/bin/scheck phase2
Points will be assigned for this assignment in the following manner:
This assignment is due on Sunday March 10. You should be able to easily finish the assignment by then. However, this is the Sunday before Spring Break and I will not charge any late penalty for assignments submitted during Spring Break. Therefore, to receive full credit for the assignment, you must turn in your files prior to 8am on Monday March 18. Submissions between 8am March 18 and 8am March 19 will have a late penalty of 15 points. Submissions between 8am March 19 and 8am March 20 will have a late penalty of 30 points. No program may be turned in after 8am on Wednesday March 20.
Remember: you are expected to do your own work on this assignment.
Comments and questions should be directed to hatcher@unh.edu