This phase concerns the compilation of C statements. Your work will be done in the context of the CS712 compiler pcc3. The phase3 release of the pcc3 source files will be available in ~cs712/public/phase3 on Monday March 18. You can begin your work on phase 3 by using your code from phase 2.
At the 70% level, you should implement the following statements: while, if, break and continue.
At the 85% level, you should also implement the following statements: for and do-while.
At the 100% level, you should also implement the following statements: label, case, default, switch and goto.
There are two steps to implementing these statements: add semantic analysis and add code generation support. The semantic analysis code for each statement should be placed in the corresponding routine in analyzeStmt.c. The code generation code for each statement should be placed in the corresponding routine in encodeStmt.c. The Alpha code to be used for each statement will be discussed in class.
You do not need to support pointer and array types at this time. This will be added as part of phase 4.
Be sure to consider semantic errors.
Your code will be graded primarily by testing it for correct functionality. However, you may lose points if your program is not properly structured or adequately documented.
Your code will be graded using a CIS Alpha so be sure to test in that environment.
Your code should be submitted for grading from a CIS Alpha.
To turn in this assignment at all levels, type:
~cs712/bin/submit phase3 analyzeStmt.c encodeStmt.c
Submissions can be checked by typing (also on a CIS Alpha):
~cs712/bin/scheck phase3
To receive full credit for the assignment, you must turn in your files prior to 8am on Monday April 1 (no joke!). Late submissions will be accepted at the penalty of 5 points per day up to one week late.
Remember: you are expected to do your own work on this assignment!
Comments and questions should be directed to hatcher@unh.edu