DD2456 - Laboratory Exercise 2.

An Object Calculus (OC) Interpreter.

This exercise is designed to deepen your understanding of the object calculus. It will give you the chance to write and execute simple object calculus programs.

1. Getting Started

You can develop an OC interpreter on any platform you wish, but consider that you will have to demonstrate your interpreter to me personally. In the past I have found that either a NADA Unix terminal or your own laptop in my office are the two easiest methods to use.

1.1. The Interpreter Requirements

The requirements on the OC interpreter are as follows:

1. The interpreter shall be able to read in an OC program (i.e. an OC term) as a string either from the keyboard or from a named file.

2. The interpreter shall be able to parse the OC term. If the input term is syntactically well-formed the interpreter shall construct a parse tree representation. If the input term is not syntatically well-formed, the interpreter should return an appropriate error message (such as "unmatched bracket"). The interpreter may return a pointer to where the error lies in the term.

3. If a parse tree can be successfully constructed for the input term, the user shall be informed of this. Then the user shall be able to execute the OC term by the method of "weak reduction". (See course notes). An OC program may get into an infinite loop, and no method is practically possible to prevent this. Otherwise the OC program will terminate under weak reduction.

4. If the OC program terminates under weak reduction, the interpreter will print out the resulting parse tree in the form of a string. The output shall be printable either to a named file, or to the screen. The interpreter will keep track of how many individual reductions were made on the input term parse tree. On request, the interpreter will display how many reductions were made.

5. It shall be possible for the end user to single-step through the reduction of an OC term, applying just one weak reduction at each step. In this case the interpreter will display the new form of the parse tree as a string on the screen, after each individual reduction. This is to make debugging of OC programs easier.

6. The interpreter shall have an appropriate graphical user interface that makes the various user activities easy to carry out.

7. The interpreter shall support the execution of type free lambda terms, either directly using beta reduction, or else by translating them into OC terms and executing them with OC weak reduction.

8. The interpreter shall support the integer data type together with the successor and addition, subtraction, and multiplication operations.