Compiling with Continuations, Continued, Andrew Kennedy. ICFP 2007.

We present a series of CPS-based intermediate languages suitable for functional language compilation, arguing that they have practical benefits over direct-style languages based on A-normal form (ANF) or monads. Inlining of functions demonstrates the benefits most clearly: in ANF-based languages, inlining involves a renormalization step that rearranges let expressions and possibly introduces a new â€˜join pointâ€™ function, and in monadic languages, commuting conversions must be applied; in contrast, inlining in our CPS language is a simple substitution of variables for variables.

We present a contification transformation implemented by simple rewrites on the intermediate language. Exceptions are modelled using so-called â€˜double-barrelledâ€™ CPS. Subtyping on exception constructors then gives a very straightforward effect analysis for exceptions. We also show how a graph-based representation of CPS terms can be implemented extremely efficiently, with linear-time term simplification.

## Recent comments

7 hours 57 min ago

8 hours 12 min ago

8 hours 31 min ago

11 hours 34 min ago

11 hours 46 min ago

23 hours 12 min ago

23 hours 42 min ago

23 hours 56 min ago

1 day 6 hours ago

1 day 7 hours ago