C311 Fall 1996 -- Programming Languages

Assignment 5: Recursion and Dynamic Scope

Due Friday, October 11, 5:00P

Start with your solution to assignment 4 (or our solution).

  1. Extend expand to implement letrec. You may use either of the expansions given in class.
  2. Extend the interpreter of the last assignment with a new form that has the same syntax as the lambda form, but with the keyword delta instead of lambda. References to variables that occur free in a delta form are resolved in the environment in which the procedure created by evaluation of the delta form was invoked. Thus in a program that used only delta binding forms (no let, letrec, or lambda forms) variable references would all be resolved according to the dynamic scope rule. Of course a program that did not use the delta form would use entirely static scope. (See EOPL Exercise 5.7.4 for an implementation hint.)
  3. Invent a program in this language that is as small as possible, uses both lambda and delta forms, and gives a different answer than it would if all its uses of lambda (not from let or letrec expansion) were replaced by delta, and a different answer than it would if all its uses of delta were replaced by lambda. Bind the datum representing this program to the top-level variable strange.

The preliminary remarks of the third assignment apply.

It is suggested that you use the new grammar checker, which will be discussed briefly in class.

Test Cases

For a list of test cases, take a look at this sample scheme interaction output.

Submission

As before, but refer to "handin 5".


Chris Haynes / chaynes@indiana.edu