...
A binding
is a pair (make-binding s v)
where s is a symbol (a variable) and v
is a boolean value (an element of { true
, false
}.
An environment
is a (list-oof of binding)
.
When the eval
function encounters a variable (symbol), it looks up the symbol in the environment and replaces the symbol it's boolean value if it exists.
...
Use the following set of reduction rules to perform this conversion
Code Block |
---|
(make-If X false true) => (make-Not X) |
...
(make-If X Y false) => (make-And X Y) |
...
(make-If X true Y) => (make-Or X Y) |
...
(make-If X Y true) => (make-Implies X Y) |
...
|
where X
, Y
, and Z
are arbitrary If
forms. This set of rules is Church-Rosser, so the rules can safely be applied using simple structural recursion.