Due April 12, 1999 before class

Read Chapter 5 in the EOPL book.

The directory /cs/classes/cis624/www/code/coreScheme/ contains the beginnings of a Scheme interpreter written in Java. The Syntax.* classes are already complete. Semant.* has been partially implemented, and can be compiled and run. Documentation can be found at /cs/classes/cis624/www/code/coreScheme/doc/.

For example,

/cs/classes/cis624/www/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


Page visited times since November 18, 1996.

sabry@cs.uoregon.edu