Due April 22, 1997 before class

Read Chapter 5 in the EOPL book.

The directory /cs/classes/cis624/www/assignments/coreScheme/ contains the beginnings of a Scheme interpreter written in Java. For example,

/cs/classes/cis624/www/assignments/coreScheme > javac schemeInterp.java
/cs/classes/cis624/www/assignments/coreScheme > java schemeInterp
Java> 3
==>
3
Java> +
==>
+
Java> #t
==>
#t
Java> (if (if #t #f #t) 33 99)
==>
99
Java> (+ 2 (* 4 2))
==>
10
Java> (= 4 5)
==>
#f
Java> (if (= 4 5) (+ 2 1) (- 2 1))
==>
1
Complete the interpreter by adding clauses for the following Scheme expressions: All of your modifications will be in the package Semant. Most of them will go in the class Interpret, but some will go in the package Semant.RunTime. When you are done, try the following examples as a sanity check:
Java> (let ((x 3)) 
        (let ((f (lambda () x))
              (g (lambda () (set! x 10))))
          (let ((d (g)))
            (f))))
==>
10
Java> (letrec ((fact (lambda (n) (if (= n 0) 1 (* n (fact (- n 1))))))) 
        (fact 5))
==>
120



Amr A Sabry
Tue Apr 1 08:12:00 PST 1997