SE580: Homework 1

Deadline: 5.30pm, Tuesday 18 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!

Each test file TestNN.hob produces an output TestNN.txt file containing a run of the program in TestNN.hob. This is then compared with the file TestNN-aim.txt: if the files are the same, then the test passed, otherwise it failed.

In this case, the test failed because the pretty printer for values is not finished. You can find the code for printing values in hobbes/ast/val/Val.java. If you edit and recompile this file, you should be able to get the tests to pass.

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