CS 541 Lecture -*- Outline -*- * Non-local exits use the power of continuations to design control-flow constructs ** call-with-current-continuation Value = ... + Expcont valE[[(call/cc E1)]] = \u\k . valE[[E1]]u (\e1 . cases e1 of isProcedure(p) -> (p inExpCont(k) k) else error-cont end) valE[[(call E1 E2)]] = \u\k . valE[[E1]]u (\e1. cases e1 of isProcedure(p) -> ... [] isExpcont(k2) -> valE[[E2]]u (\e2. (k2 e2)) [] err-cont end) ** block and exit constructs (see control handout, second part) (block I) declares an exit point ** goto (Schmidt 9.5) *** keep command continuations for labels in environment. valC[[goto I]] = \u\k.(lookup u [[I]]) *** mutual recursion resolved by fixpoint to construct environment