An introduction to Continuation Passing Style (CPS)
summary
Shows how turning every function into one that takes a continuation argument — a CPS transform applied to Scheme examples — makes control flow explicit, lets the compiler lower code to tail calls and removes stack growth for deep recursion, and enables new control operators. Demonstrates converting a recursive routine into a tail-recursive conversion that no longer grows the stack and sketches implementing /simulating/ call/cc simulation and small compiler-backend steps that actually run.
AI-written summary · about
chapters (6)
- 0:00Start
- 2:52Lexical Scoping
- 13:19Delimited Continuations
- 31:42What Is a Break Value
- 43:12Accumulator Passing Style
- 48:06Examples
related talks
36mTaming the stack
01h 28mTutorial on Program Transformations
24mA Big-Step Compositional Continuation-Passing Semantics for WebAssembly
37mTCO
15mCompiling with Continuations, Correctly
29mHigher-Order Weakest Precondition Transformers via a CPS Transformation
13mOne-Pass CPS Translation of Dependent Types (Talk Proposal)
19mTowards a Reflection for Effect Handlers
