CSCE 531
Spring 2019
Project Part IV
Due Monday, April 29, 2017
(no late submissions accepted)

NOTE: The handout below gives regular point values for grading. Because this part of the project overlaps with Project III, the 80% level described below will be considered full credit and any higher levels are extra credit for the project (90% = 10% extra; 100% = 20% extra.

As usual, undergraduates will be given a 10-point boost on this project part.

Process C pointer and array operations.

To receive 80% of the credit: You must process the indirection operator (*) and the address operator (&). You must also upgrade your processing of the following operators for pointer operands: =, <, >, and ==. You should also support the use of `0' (the NULL pointer) with pointer types. You should be able to handle pointers to char, to int, to float, to double, and to other pointers.

Do NOT support any conversions between pointer types or between integers and pointers (other than `0' to a pointer). In other words, flag pointer/pointer and integer/pointer type mismatches as semantic errors.

Be sure to do the other appropriate semantic checks: the (unary-converted) operand of the indirection operator must be of pointer type, the address operator expects an l-value but does not produce an l-value, an operand of the multiplication operator (binary *) cannot be a pointer, etc.

To receive 90% of the credit: You must first obtain the 80% level. You must also upgrade your processing of the + and - operators to handle pointer types (two pointers of the same type may be subtracted, producing an integer; an integer and a pointer may be added, producing a pointer; and, an integer may be subtracted from a pointer, producing a pointer). Finally, you must also process the subscript operator (`[]') on both pointer types and array types. You should be able to handle arrays of char, of int, of float, of double, and of other arrays or pointers.

Be sure to do the semantic checks appropriate for this level: detect illegal subscripting expressions, array types are illegal operands for most operators, an array name is an r-value, etc.

To receive 100% of the credit: You must first obtain the 90% level. You must also process pointers to functions. This requires you to be able to process declarations involving the function type modifier.

To implement function pointers you must upgrade both the standard unary conversions and the standard assignment conversions (to allow a function name to be converted to a function pointer). You should also allow function pointers to be used in function calls generally.

As usual, be sure to do the semantic checks appropriate for this level: a pointer involved in a function call must be a function pointer, you cannot subtract two function pointers, you cannot add an integer and a function pointer, etc.

As in Project parts I and II and III: your compiler should be capable of detecting multiple semantic errors in one file, and you may allow the compiler to stop processing with the first syntax error.

The file proj4test.zip unzips to a director containing test files. These may not be the only test files that will be used when grading, so do your own testing too. All test files will assume the 80% level of Project Part I and the 80% level of Project Part II. There are only two additional back-end functions needed for this part: b_ptr_arith_op(), which handles pointer arithmetic operations, and b_funcall_by_ptr which calls a function from a pointer to its code. As stated above, the 100% level of this project uses declarations involving function type modifiers.

Remember: you get credit for features successfully implemented. You do not get credit for attempting to do something; you get credit for the things that you can successfully demonstrate work. Also remember: as always you are expected to do your own work on this assignment. Finally: you should adequately document and structure your program.

You must turn in all source files (even the ones I gave you) and a Makefile and README file for your compiler.