[lambdaheads]Program 1


Recall the definition of the AExp datatype from class. Consider adding the let construct to this language and creating the new datatype, ALetExp. A let form looks like

(let (var val) body)
where var is a variable and val and body are expressions (ALetExp's). An sample expression is
(let (x (1 + 2)) (x * x))
Note that you are only asked to write a parser, not an interpreter.

Turn in all the code needed to parse this extended language. Your parser is due by 11am on 2000-09-11. Email the code to the TA before, and submit it in print at, the start of class. You may have to make some assumptions about the syntax of programs; document them!

Challenge: Try to formulate a reduction rule for let. A reduction rule specifies how computations are converted into values. For example, the reduction rule for + says to reduce the two sub-expressions to numeric values, then perform Scheme addition on the resulting numbers. Try to formulate one for let. Be concise, but also be correct! (Warning: If you haven't done this before: it's trickier than you think.)