Com S 641 Lecture -*- Outline -*- * Untyped Imperative Calculi (Ch 10) ** Syntax (10.1) explain basics clone is shallow let controls evaluation order Q: How can you simulate functional update using this calculus? Q: What is the sugar for sequential evaluation (;)? Q: Can we use sequential evaluation to make a sugar for let? Q: what does this say about which is more primitive? ** Fields (10.2) Q: why don't the field sugars at the beginning of section 10.2 work well? Q: would this be different if we didn't have imperative features? Q: could we fix that using a sugar based on let? Look at the translation on the p. 131 Q: in what order are the expressions in a field update evaluated? ** procedures (10.3) Q: what's the difference between let and var? Q: what kinds of things can be the target of an assignment statement? Q: can a let-bound variable be assigned to? Q: what does var x = a in b desugar into? Q: why is cloning needed in the desugaring on application? ** examples (10.4) Q: can you explain the coding of the Booleans? Q: why don't we need separate versions of the Booleans for each type? have them read the other examples ** operational semantics (10.5) Q: why is there are no equational logic given for this calculus? *** reduction rules (10.5.1) Q: was the role of the store? The stack? Q: is this a big step or little step semantics? Q: can you explain the rules on page 137? *** examples of reductions (10.5.2) work through a couple of the examples *** variations Q: Can you write a (big step) operational semantics for the Imp-s-f calculus? Q: How does this relate to the desugaring? Q: Can you write a little step semantics for the Imp-s calculus? Q: what are the contexts? How do they preserved evaluation order? Q: does it preserve variable scoping? try an example --------------------------------------------------------- let x = [] in let a = [l=s(y)x] in let y = [] in let q = a.l in let r = a.l <= s(z)y in a.l ---------------------------------------------------------