SE580: Homework 9

Last homework! Deadline: 5.30pm, Thursday 13 November 2003.

Homework

Download and unpack the interpreter archive for this course, and make sure you can compile and run the interpreter.

When you run the interpreter, you will get messages saying "Tests failed". Your homework is to get rid of these messages!

Note that the typechecker compiles, but it does not check programs which use myType, for example:

Interpreting interpreter/tests/TestPoint02.hob
At line 69
the interpreter produced output
  Exception: Method <= in class ColoredPoint has parameter p with undefined type myType
rather than
  // Initial state typechecked OK!

This week, the problem is that the static semantics of Hobbes is not complete. It is missing most of the code for dealing with myType You should edit hobbes/statics/TypeCheck.java to finish the interpreter. Note that TypeContext.java does not need to change, and in particular it already contains a version of getMethod and getField which takes an extra type parameter to replace myType, as discussed in class.

You should add comments to the code, indicating which edits you made, for example:

  // Edited by Wilma Flintstone:
  print ("hello");
  // End of edits.

Once you have a working edited version of TypeCheck.java, create a zip archive containing that file, plus any other files you edited, and submit it using the Course OnLine system.