CS712/CS812
Project Phase 3
Spring 2003
Due Sunday March 30


This phase concerns the compilation of C expressions. 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 10. You can begin your work on phase 3 by using your code from phase 2.

This is a lengthy (but not difficult) assignment. If at all possible you should start this assignment early, even before the Phase 2 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 IA-32 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 5.

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 turing.unh.edu so be sure to test in that environment.

Your code should be submitted for grading from turing.unh.edu.

To turn in this assignment at all levels, type:
~cs712/bin/submit phase3 analyzeExpr.c encodeExpr.c

Submissions can be checked by typing (also on turing.unh.edu):
~cs712/bin/scheck phase3

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

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