COS 320, Spring 2000. Programming Assignment

Programming Assignment 5: Type Checker

Described in Modern Compiler Implementation, Chapter 5.
(Only part a, the non-recursive part, is required.)

Type checking

  1. Copy /u/cos320/chap5/* into a new directory as5.
  2. Copy your working tiger.lex and tiger.grm from assignment 4. If you don't have working versions, then don't copy them! CM will automatically use versions that are provided.
  3. Edit the file semant.sml to implement the function transProg. You don't have to handle recursive type definitions or recursive functions. (But it is not that much more work to handle them anyway.)
  4. For this assignment, your type checker does not have to but might as well make sure that all break statements occur within some loop.
  5. As usual, compile by invoking CM.make();.
  6. You can test your code by running Test.typecheck "file".
  7. Submit by running submit 5 semant.sml.

Extra credit

  1. Implement mutually recursive functions.
  2. Implement recursive type definitions.
  3. Detect cyclic type definitions.
  4. Check for proper nesting of break expressions.