CS712/CS812
Possible Phase 3 Assignments
Spring 2001


You will be assigned one of the following tasks. Please let me know by Tuesday April 3 any preference you might have. I will give you a definite assignment no later than Wednesday April 4. This phase ends on Sunday April 22.

  1. Add semantic analysis and code generation support for pointers and arrays. This first involves implementing the operators for array indexing and pointer dereferencing. Next you need to be sure the previously implemented operators (=, + , -, ==, etc.) are upgraded to properly handle arrays and pointers. You should also be sure that pointers and arrays can be passed to functions and returned from functions (if legal). The array and pointer operations provide additional lval possibilities, so you will need to fix the isLval and isModifiableLval routines. And you need to think hard about whether there are additional places in the compiler (such as the control expressions for control-flow constructs) that need to be upgraded for pointers and arrays.

    Be sure to carefully consider what semantic errors need to be detected and reported in the processing of arrays and pointers. When errors are encountered, use the "error TYPE" to denote the existence of the error in the abstract-syntax tree and key on the "error TYPE" to avoid a cascade of errors. This is in addition to issuing an appropriate error message through the message module, of course.

  2. Add semantic analysis and code generation support for the comma operator, the ?: operator, casts, sizeof and the following assignment operators: *=, /=, %=, +=, and -=.

    Be sure to carefully consider what semantic errors need to be detected and reported in the processing of these operations. When errors are encountered, use the "error TYPE" to denote the existence of the error in the abstract-syntax tree and key on the "error TYPE" to avoid a cascade of errors. This is in addition to issuing an appropriate error message through the message module, of course.

  3. Add support for the following operators: |, &, ^, >>, <<, ~, |=, &=, ^=, >>=, <<=

    You should add support to both the semantic-analysis routine ("analyze") and the code-generation routine ("encode").

    Be sure to consider semantic errors. When errors are encountered, use the "error TYPE" to denote the existence of the error in the abstract-syntax tree and key on the "error TYPE" to avoid a cascade of errors. This is in addition to issuing an appropriate error message through the message module, of course.

  4. Add support for the following statements: switch, goto and do-while. Also add support for goto labels.

    You should add support to both the semantic-analysis routine ("analyze") and the code-generation routine ("encode").

    Be sure to consider semantic errors.

Code produced by the class during Phase 2 will be available in ~cs712/public/phase3. I will place code there as soon as I have had a chance to evaluate the Phase 2 submissions. You must build your phase 3 contribution upon this "officially sanctioned" code base.


Last modified on March 30, 2001.

Comments and questions should be directed to pjh@cs.unh.edu