Compilers (CS362 2002F)

Project, Phase 3: Type Checker

Assigned: Friday, November 8, 2002
Due: Wednesday, November 20, 2002

This assignment is optional!

Summary: In this stage of the project, you will design and build a portion of the the type checker for your Pascal compiler.

Group Work: You should work with the same group that you worked with for the parser.

Core Assignment

Write a type checker that traverses parse trees for Pascal problems and (1) gathers type information on constants, variables, and the return type from functions; (2) checks expressions and assignment statements for type correctness; (3) prints error messages when it encounters type errors; (4) inserts appropriate coercion nodes to convert between types (e.g., from integers to reals); (5) adds a type attribute to each appropriate node in an expression; returns a value that indicates whether or not the parse tree is type correct.

Your type checker need only deal with integers, reals, and Booleans. That is, you don't need to deal with user-defined types, with records, or with arrays. Your type checker does not need to check the parameters function or procedure calls. Your type checker does need to use the return value from functions in checking expressions.

You can use my implementation of symbol tables, which should be ready by the end of today. (Expect a link and an email message.)

Extra Credit

For extra credit, do more than the minimum. For example, you could

 

History

Friday, 1 November 2002 [Samuel A. Rebelsky]

Friday, 8 November 2002 [Samuel A. Rebelsky]

 

Disclaimer: I usually create these pages on the fly, which means that I rarely proofread them and they may contain bad grammar and incorrect details. It also means that I tend to update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.

This document was generated by Siteweaver on Wed Nov 20 11:06:43 2002.
The source to the document was last modified on Wed Nov 20 08:50:15 2002.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS362/2002F/project.03.html.

You may wish to validate this document's HTML ; Valid CSS! ; Check with Bobby

Glimmer Labs: The Grinnell Laboratory for Interactive Multimedia Experimentation & Research
glimmer@grinnell.edu