CS 674

Assignment 8
Due Wednesday, December 2nd
Refer to this class diagram in the following exercises.

  1. Add constructors (and role names, as useful) for Compound, Assignment and Block in the class diagram.

  2. A Type is either an IntType or a BooleanType. Add the class declarations to the object diagram for the Simple Intermediate Language.

  3. In the class diagram, a Block introduces an identifier into a statement. Extend Block so that the identifier has a Type associated with it.

  4. Parameterize the Env class over the class that can be associated with an identifier. Express the current environment in terms of the parameterized environment and show a new class of environment associating identifiers with types.

  5. Using the visitor pattern, define the visitor classes for the Expression and Statement classes.

  6. Add the modifications to the class diagram from the previous 5 exercises to your implementation of the class diagram.