A Type Analyzer for C--


To solve the type analysis problem for C--:

Due dates

You must complete the PEP tasks (individually), and then hand in the requested material (as a group) at the beginning of class on Monday, October 26. This assignment is worth 40 points.


C-- is defined in Appendix A of Waite. Section A.1.3.1 defines the meaning of type, and the remainder of the definition places a number of restrictions on the type of value that can appear in specific contexts. A C-- compiler must report violations of these restrictions.

Violations of type restrictions are reported in the context in which they occur, using the source text coordinate system. There is no need to control the production order of the error reports, since each is accompanied by the appropriate coordinates.


Implement a type analyzer for C--, using any tools and techniques you wish. Combine your type analyzer with the structural analyzer and the name analyzer that you implemented for earlier assignments. Your program must read input text, construct the corresponding source program tree, and report violations of all context conditions if the text is lexically and syntactically correct. If the input text is incorrect according to the lexical or syntactic rules of C--, your program must report at least the first error. It may terminate immediately after reporting the first error, or it may continue in an attempt to detect further errors.

Test your program by applying it to the C-- test suite. If you feel that the test suite is inadequate, provide any additional tests you deem necessary. Your program should not detect any errors in any conformance test, and it should detect at least one error in every deviance test.

A directory containing the complete source code (or specifications, if you used tools) for your program must be permitted for world read by 1700 on the due date for this assignment. You need not make it available to be read by others before that time. Hand in the location of this directory (machine and path name).

Complete your personal postmortem for this assignment and your personal project plan for the next assignment, and submit them via the web before class on the due date of this assignment.

Revision 1.1 (1998/09/29 17:43:11)