C311 Assignment 5 -- Introduction to Scheme++
Due Monday, February 13th, at 8:55 AM
Read and study carefully the introduction to Scheme++
for C311. Your comments on this introduction are especially
welcome. The copper:/u/c311/bin/scheme script should be fixed
today to support Scheme++.
Submit via email
The code for the introduction's lambda calculus
example is in copper:/u/c311/ss/lambda.ss. Extend this code to
incorporate a substitute method in the classes derived from the
syntax class in the same manner as the original classes derived from the
syntax class were extended to include rename methods. You will
need to redefine the class <syntax>. Also define a
<lit> class for numeric literals that is a syntax class
and extend the parser to recognize numeric constants (self-evaluating
literals). Define global generics for the substitute and unparse methods
so they can be used as indicated in the transcript of EOPL
Exercise 4.2.3 (except that gensymed values will print differently).
> (unparse (substitute (parse '(lambda (a) (a (b 3))) (parse '(a 5)) 'b)))
(lambda (#:g0) (#:g0 ((a 5) 3)))
Hint: Define a free? method in each new class. Since this
method is not a part of the problem specification, it should not be
public.
chaynes@indiana.edu