Compiling with continuations, continued
Author:
Open Access
- 1 October 2007
- journal article
- Published by Association for Computing Machinery (ACM) in ACM SIGPLAN Notices
- Vol. 42 (9) , 177-190
Abstract
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 re-normalization 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.Keywords
This publication has 22 references indexed in Scilit:
- Bottom-Up β-Reduction: Uplinks and λ-DAGsLecture Notes in Computer Science, 2005
- Higher-order control-flow analysis in retrospectACM SIGPLAN Notices, 2004
- A first-order one-pass CPS transformationTheoretical Computer Science, 2003
- Exceptional syntaxJournal of Functional Programming, 2001
- From ML to Ada: Strongly-typed language interoperability via source translationJournal of Functional Programming, 1998
- SSA is functional programmingACM SIGPLAN Notices, 1998
- A reflection on call-by-valueACM Transactions on Programming Languages and Systems, 1997
- Shrinking lambda expressions in linear timeJournal of Functional Programming, 1997
- Representing Control: a Study of the CPS TransformationMathematical Structures in Computer Science, 1992
- Notions of computation and monadsInformation and Computation, 1991