CS712/CS812
Project Phase 2
Spring 2002
Due Sunday March 10


This phase concerns the compilation of C expressions. Your work will be done in the context of the CS712 compiler pcc3. The phase2 release of the pcc3 source files will be available in ~cs712/public/phase2 on Monday March 4. You can begin your work on phase 2 by using your code from phase 1.

This is a lengthy (but not difficult) assignment. If at all possible you should start this assignment early, even before the Phase 1 due date.

At the 70% level, you should implement the arithmetic operators: +, -, *, /, %, unary -, unary +, +=, -=, *=, /=, and %=.

At the 80% level, you should also implement the relational operators: !, <, >, <=, >=, ==, !=, &&, and ||.

At the 90% level, you should also implement the bitwise operators: ~, <<, >>, &, ^, |, <<=, >>=, &=, ^= and |=.

At the 100% level, you should also implement these operators: ++, --, ?:, cast, sizeof and comma.

There are two steps to implementing these operators: add semantic analysis and add code generation support (if necessary). The semantic analysis code for each operator should be placed in the corresponding routine in analyzeExpr.c. The code generation code for each operator, if needed, should be placed in the corresponding routine in encodeExpr.c. The Alpha code to be used for each operator 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.

Many of the routines in semUtils.c will be useful on this assignment.

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 phase2 analyzeExpr.c encodeExpr.c

Submissions can be checked by typing (also on a CIS Alpha):
~cs712/bin/scheck phase2

To receive full credit for the assignment, you must turn in your files prior to 8am on Monday March 11. 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!


Last modified on January 31, 2002.

Comments and questions should be directed to hatcher@unh.edu