Teaching
G711 F '05
 
Assignments
Set 1
Set 2
Set 3
Set 4
Set 5
Set 6
Set 7
Set 8
Set 9

Problem Set 6: Understanding Control

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.


last updated on Tue Jun 9 22:21:18 EDT 2009generated with PLT Scheme