Submission Instructions

This is an individual assignment! Discussion with friends, TAs, and instructors is allowed, however, the actual work should be your own. Course staff runs plagiarism detectors, and will treat excessive similarities between submissions as evidence of cheating. Submit in Submitty. Your Scheme file should be named yabi.rkt. Submitty runs a command-line r5rs interpreter. Make sure that you change the language in DrRacket to R5RS!

Yet Another Boolean Interpreter

We've written Boolean expression interpreters in Java and Prolog, and it's time to write one in Scheme! The goal of this problem is to write an interpreter for a simple functional language called BOOL. A BOOL program is a list, as defined by the following grammar; all terminals are shown in boldface.

program( prog expr )
expr → id
expr → const
expr
( myignore expr )
expr
( myor expr expr )
expr
( myand expr expr )
expr
( mynot expr )
expr
( mylet id expr expr )
id
a | b | ... | z
const
true | false

Here are five valid BOOL programs

Each BOOL program and expression evaluates to a boolean value. The semantics of a program is defined as follows:

Based on these rules, the five programs from above are evaluated as follows:

Write a Scheme function myinterpreter that takes as input a list of BOOL programs and produces a list of the corresponding boolean values. For example, an invocation

 
( myinterpreter '( (prog false) (prog (mylet z (myor true false) (myand z true))) ) )
 

should evaluate to the list (#f #t). Your implementation should work with the R5RS Language in DrRacket.

Minimal starter code is provided here.

NOTE on grading: This homework is worth a total of 40 points. (Scheme Part 2 is worth 60 points.) 30 points will be awarded for functional correctness by the autograder. However, we will override the autograder if you have violated the restrictions on functions! 10 points will be awarded for the quality and completeness of your comments.

Errata

None yet. Check the Announcements page regularly.