Computer Science 4627
Type Checking

Read this entire assignment before you begin on it.

Now that you have a table manager, modify your compiler to perform type checking. Do the following.

  1. Add a type attribute to each of the expression nonterminals. It should be a synthesized attribute that tells the type of the expression. Modify your parser to compute this attribute.

  2. When computing the type attribute, check that types make sense. Check the use of functions. Are the correct number of arguments present? Do they have the desired types? You will want a function that compares two types and tells whether they are the same.

  3. Test your compiler. Try it on programs that contain type errors. It should give error messages.


What to turn in

Turn in all of your source files, including any that you have turned in earlier.