Due date: 10/25 @ 5:00 pm
This goal of this problem set is to understand the addition of control
features to programming languages.
Use the Pretty Big language and require the EoPL language.
Add a construct for grabbing the current control state to the language of Problem Set 5:
Block is: { Declarations* Statement+ }
Declaration is: (Type Variable = Expression)
Type is one of:
-- bool
-- int
-- (Type -> Type)
-- (control)
Variable is: alphanumeric sequence of characters
Expression is one of:
-- Variable
-- Number
-- (Expression + Expression)
-- (Expression > Expression)
-- (procedure (Parameter*) Block)
-- (Expression Expression*)
Parameter is: (Type Variable)
Statement is one of:
-- (Variable = Expression)
-- (if Expression Block else Block)
-- (while Expression Block)
-- (return Expression)
-- (escape Variable Block)
Revise the implementation of the return statement so
that it jumps out of execution sequences via a continuation.
The new escape statement grabs the current continuation, binds it
to the given variable whose scope is the given block.
Problem 1:
Define a representation for expressed values in this language.
Define a representation for denoted values in this language.
Problem 2:
Modify your favorite interpreter from Problem Set 5 for this variant of
the language. Use Scheme's call/cc to implement the
escape statement.
Problem 3:
Eliminate call/cc from the interpreter in Problem 2.