SE580: Homework 2

Deadline: 5.30pm, Thursday 25 September 2003.

Homework

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

  cd interpreter
  javac hobbes/test/Main.java
  java hobbes.test.Main tests/Test*.hob
  java hobbes.test.Main tests/Fail*.hob

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

This week, the problem is that the abstract syntax tree for Hobbes is not complete. It is missing two classes: DecClassImpl and DecObjectImpl (both in file hobbes/ast/dec/Dec.java). You should complete these two classes.

Hint: remember that the Hobbes AST is immutable so once an AST node is created, it never changes! In particular, you may want to use the hobbes.util.Dictionary class of immutable dictionaries.

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 Dec.java, create a zip archive containing that file, plus any other files you edited, and submit it using Courses On Line.