In Chapter 2, Winskel defines an example language called IMP that he will use as an example to define various semantic concepts. Chapter 2 defines the operational semantics of IMP using both big step, or natural semantics, and small step semantics. For this mini-project, you will define both big and small step interpreters for IMP.

  1. Define an abstract syntax for the full IMP language.
  2. Implement the abstract syntax defined in Part 1.
  3. Define a large-step operational semantics for the abstract syntax defined in Part 1. Note that most, if not all, of this semantics is defined in your text.
  4. Implement a large-step evaluation function for the abstract syntax defined in Part 2. Your evaluation function should accept an abstract syntax structure and an initial state, and produce a final state.
  5. Define a small-step operational semantics for the abstract syntax defined in Part 1.
  6. Implement a small-step evaluation function for the abstract syntax defined in Part 2. You should provide an interface to your top-level interpretation function that has the same signature as your large-step interpreter.
  7. Define a proof scheme for your small-step operational semantics similar to that defined for the large-step operational semantics defined in the text.
  8. Provide evidence that your interpreters from Part 4 and Part 6 are equivalent. Do not attempt a formal proof or exhaustive testing, simply provide a collection of test cases that demonstrate the equivalence of the two interpreters.
Defining an interpreter will involve developing a representation for state that will accept a location name and return the value associated with that name. Scheme association lists or Haskell list of pairs work nicely for this. If you try to access a location that has not been initialized, your interpreter should throw an error. Note that it is perfectly acceptable for your test cases to use a memory that has already been initialized.

In essense, there are three activities to this project - defining semantics, implementing interpreters and establishing correctness. We will repeat these steps in form for each of the semantic systems that we learn. This project emphasizes implementing interpreters. As we move further into the semester, definition and correctness will play a larger role.

Due: October 13