Home Assignments Lecture Blog Resources Project Discussion Group

The Metacircular Evaluator


In this problem set, you’ll learn how to implement Scheme in Scheme—a “meta-circular evalator.”

We'll extend starter code with new features.


This material is based on the discussion in the book, Chapter 4.1, The Metacircular Evaluator.

The Code

To run the metacircular evaluator, download from the course web site. Note: you must run it with the R5RS language—select “Choose Language...” from the pop-up menu in the lower-left corner of a main Racket window.

After evaluating the code buffer, evaluate (mc-eval-loop) in the REPL. This will run the interactions for your metacircular UML Scheme world. Remember that everything you type in (except for variables and numbers) should be prefixed by “uml:” – if you forget, the system will have an error. If you type in an error, the driver-loop exits and you will lose the state you had in the metacircular world.

You only need to turn in the portions of the code that you change.

Warm-up: Run the metacircular evaluator and evaluate some UML Scheme expressions. Nothing to turn in for this part.

Note: for all problems, make sure to all turn in the expressions you evaluated inside your meta-circular evaluator that demonstrate that your implementations are functional! 50% of the credit will be for a correct implementation, and the remaining 50% is for correctly demonstrating that your code works. Thank you.

Problem 1: Exercise 4.4 (“or” only) on p. 374. Remember to name your new “or” as “uml:or”.

Problem 2: Exercise 4.1 on p. 368.

Problem 3: Problem 3 has been removed from the PS.

Problem 4: Exercise 4.9 on p. 376. Pick one of the iteration constructs (do, for, while or until) to implement.


On the CS cluster, turn in a code file with:

submit fredm 301-ps10 <your-file>