Program 2: Semantic Analysis

Assignment:

Add semantic checks to your compiler. If your compiler accepts a source program, then it is a valid ice9 program in every way.

Description:

Each type checker inputs a source program written in ice9. If the source program is syntactically and semantically correct, your compiler will output nothing. On the other hand, when your compiler discovers an error (of any type) it issues an error message.

For lexical and syntax errors, use the same message format as in Program 1. Do not change the parser message processing. Do not continue processing the input after a syntax error.

For semantics errors, provide enough detail that a programmer could make the correction. For example, consider the following ice9 statement:

a := b + c;

The error message "invalid type" is insufficient. Is a different from b + c or is b different from c? A sufficient error message is

"f.9: 25: Different types in assignment",

where 25 is the line number in f.9 at which the error occurred. (This is by no means the only valid error message.)

Turnin:

Copy all your source files, including a Makefile, to your turnin directory by the specified time. Do not include binaries or object files.

Grading:

Testing consists of type checking a set of files. A substantial subset of these files is available. If the input is a syntactically and semantically valid ice9 program your program outputs nothing. The test program files have different point values; no partial credit. Students' program will be graded semi-automatically. Therefore, students must ensure that error messages are clear and obvious.
vin@cse.nd.edu
Last modified: Mon Feb 4 14:10:43 EST 2002