The following interpreter for Camille supports both local binding and conditional evaluation:6
Table 10.1 summarizes some of the details of the exercises here.
Table 10.1 New Versions of Camille, and Their Essential Properties, Created in the Chapter 10 Programming Exercises. (Key: ASR = abstract-syntax representation; CLS = closure; LOLR = list-of-lists representation.)
Exercise 10.1 Reimplement the interpreter given in this chapter for Camille 1.2.a to use the abstract-syntax representation of a named environment given in Section 9.8.4. This is Camille 1.2(named ASR).
Exercise 10.2 Reimplement the interpreter given in this chapter for Camille 1.2 to use the list-of-lists representation of a named environment developed in Programming Exercise 9.8.5.a. This is Camille 1.2(named LOLR).
Programming Exercises 10.3–10.5 involve building Camille interpreters using nameless environments that are accessed through lexical addressing. These interpreters require an update to the definition of the p_line_expr function shown at the end of of Section 10.6.1 and repeated here:
We must replace line 85 with lines 85 and 86 in the following new definition:
Exercise 10.3 Reimplement the interpreter for Camille 1.2 to use the abstract-syntax representation of a nameless environment developed in Programming Exercise 9.8.9. This is Camille 1.2(nameless ASR).
Exercise 10.4 Reimplement the interpreter for Camille 1.2 to use the list-of-lists representation of a nameless environment developed in Programming Exercise 9.8.5.b. This is Camille 1.2(nameless LOLR).
Exercise 10.5 Reimplement the interpreter given in this chapter for Camille 1.2 to use the closure representation of a nameless environment developed in Programming Exercise 9.8.7. This is Camille 1.2(nameless CLS).
Exercise 10.6 Implement l e t* in Camille (with the same semantics it has in Scheme). For instance:
This is Camille 1.3.
6. Camille version 1.2(named CLS).
18.188.137.37