CS301 Problem Set 5

This assignment is worth 20 points


The purpose of this assignment is to deepen your understanding of the handling of functions in the uScheme interpreter.

Your assignment is to read section 12 of R&K Chapter 3 and all of R&K Chapter 5, then do exercise 5.1 in Section 5.9.

Procedures

This exercise asks you to modify the uScheme interpreter written in ML described in Chapter 5. You can find the source code in ~gexia/public/CS301/301-code/bare/uscheme-ml (uncommented), or with comments taken verbatim from the textbook in ~gexia/public/CS301/301-code/commented/uscheme-ml. Copy everything in this directory to your own space. To compile, type make to a shell in your directory. (It won't do anything unless the source is more recent than the object code.)

You must have the Moscow ML compiler mosmlc on your path; it's in ~gexia/public/CS301/mosml/bin/.

Caution: make sure, when testing, that you're running the modified version you've created, and not some default version on your path! Type ./uscheme to the shell, or add a line to the Makefile.

Requirements

Note that in the usual terse fashion of R&K exercises, nothing is said about modifying the interpreter's behavior for expressions other than lambda expressions. You're responsible for understanding the ramifications.

Make your modifications to mlscheme.sml, and put a set of test cases in a file named ex5.1.scm. As usual, the test cases should be top-level expressions that cause the uScheme interpreter to respond #t. For scoring purposes it's very important that your test cases will really fail if your implementation of ev for lambda expressions goes wrong. One way to make sure of this is to write a clearly bogus implementation and run it against your test cases.


Adapted from Penny Anderson.