The purpose of this problem is to develop a CEK machine for the
ISWIM*s
language from problem set 6.
Task 1
Encode your CEK machine in Redex.
Task 2
Define the cek
function, which uses the CEK machine to
map ISWIM*s
programs to answers.
Task 3
Formulate a conjecture about the relationship between eval*-s
(solution for problem set 6, imported from 8provided.rkt) and
cek
as a metafunction. Test the conjecture manually and with
redex-check
.
You must think of the imported solution as the "weather" and your own
model as a "weatherman". As you explore your solution, keep in mind that
you can't change the weather.
If testing finds a counter-example to your conjecture, formulate the
counter-example as a failing test case and explain the failure with a
one-line comment. Then fix those parts of your solution that broke so that
the test case passes.
Task 4 Add the following exception handling mechanism
to the CEK machine for ISWIM*s:
e = ... | (handle e x e) | (raise x e)
x in Variables
We say that a (raise x e_x)
expressions raises an exception
with tag x
and exception code e_x
. A
(handle e_body x e_handler)
expression sets up an exception
handler for exceptions with tag x
and then evaluates
e_body
. If the evaluation produces a value, the value is the
result of the handle
expression. If the evaluation of
e_body
raises an exception with tag x
and
exception code e_x
, then the handler
expression
evaluates (e_handler e_x)
.