Com S 342 --- Principles of Programming Languages EXERCISE 8: INTERPRETER BASICS (File $Date: 2005/03/08 18:55:17 $) The purpose of this exercise is for you to learn about the basics of the interepreters in chapter 3 of EOPL. As with all exercises, this is to be done individually. And it is due the day this topic is planned to be discussed in class, unless specified otherwise (see the syllabus at: http://www.cs.iastate.edu/~cs342/syllabus.shtml). We expect this to help you think about the readings (see below). If you don't have an answer or an answer that you think is good, write down what you read, and a question or two that would have helped you make progress. Then you can ask that question in class; there will be other people with the same problem, and everyone can learn by discussing these issues. And you'll most likely see similar things on the homework, so it's best to understand them now. READINGS: Read sections 3.1-3.2 of "Essentials of Programming Languages" (2nd ed., 2001) by Friedman, Wand, and Haynes. 1. [specifications of procedures in the interpreter] Describe, in your own words, what each of the following procedures in the interpreter does. a. eval-program b. eval-expression c. eval-rands d. eval-rand e. apply-primitive f. init-env 2. [Changes to the interpreter] Describe, in your own words, what would happen if you made the following changes in the interpreter: a. Changed eval-program to pass (empty-env) instead of (init-env) to eval-expression. b. Changed the var-exp case of eval-expression to be (var-exp (id) id) c. Changed the primapp-exp case of eval-expression to be (primapp-exp (prim rands) (apply-primitive prim rands)) d. Changed the add-prim case of apply-primitive to be (add-prim () (+ (car args) (cdr args))) WHAT TO HAND IN You should have at the beginning of class, written answers to the above questions (or written out questions and problems you encountered for each part). Make sure your name is on these. Attach the printouts, if any, requested above.