Abstract
Algorithms that convert direct-style λ-calculus terms to their equivalent terms in continuation-passing style (CPS) typically introduce so-called “administrative redexes:” useless artifacts of the conversion that must be cleaned up by a subsequent pass over the result to reduce them away. We present a simple, linear-time algorithm for CPS conversion that introduces no administrative redexes. In fact, the output term is a normal form in a reduction system that generalizes the notion of “administrative redexes” to what we call “no-brainer redexes,” that is, redexes whose reduction shrinks the size of the term. We state the theorems which establish the algorithm's desireable properties, along with sketches of the full proofs.
- Andrew W. Appel. 2006. Compiling with Continuations. Cambridge University Press.Google Scholar
- Andrew W. Appel and Trevor Jim. 1997. Shrinking lambda expressions in linear time. Journal of Functional Programming 7, 5 (1997), 515–540. Google Scholar
Digital Library
- Hendrik Pieter Barendregt. 1985. The Lambda Calculus: Its Syntax and Semantics. Studies in Logic and the Foundations of Mathematics, Vol. 103. North-Holland, Amsterdam.Google Scholar
- Richard Bird and Philip Wadler. 1992. Introduction to Functional Programming. Prentice Hall.Google Scholar
- Olivier Danvy. 2008. Defunctionalized interpreters for programming languages. In Proceeding of the 13th ACM SIGPLAN International Conference on Functional Programming (ICFP) (SIGPLAN Notices, Vol. 43, No. 9). 131–142. Google Scholar
Digital Library
- Olivier Danvy and Andrzej Filinski. 1992. Representing control: A study of the CPS transformation. Mathematical Structures in Computer Science 2, 4 (1992), 361–391. Google Scholar
Cross Ref
- Michael J. Fischer. 1993. Lambda-calculus schemata. LISP and Symbolic Computation 6, 3/4 (1993), 259–288. Earlier version originally published in Proceedings of the ACM Conference on Proving Assertions about Programs, SIGPLAN Notices, Vol. 7, No. 1, and SIGACT News, No. 14, 104–109 ( January 1972).Google Scholar
Digital Library
- Cormac Flanagan, Amr Sabry, Bruce F. Duba, and Matthias Felleisen. 1993. The essence of compiling with continuations. In Proceedings of the ACM SIGPLAN’93 Conference on Programming Language Design and Implementation (PLDI) (ACM SIGPLAN Notices, Vol. 28, No. 6). 237–247. Google Scholar
Digital Library
- Matt Kaufmann, Panagiotis Manolios, and J Strother Moore. 1990. Computer-Aided Reasoning: An Approach. Number 3 in Advances in Formal Methods. Kluwer Academic Publishers.Google Scholar
- Richard A. Kelsey. 1989. Compilation by Program Transformation. Ph.D. Dissertation. Computer Science Department, Yale University, New Haven, Connecticut. Research Report 702.Google Scholar
- Richard A. Kelsey. 1995. A correspondence between continuation passing style and static single assignment form. In ACM SIGPLAN Workshop on Intermediate Representations (SIGPLAN Notices, Vol. 30, No. 3). 13–22. Google Scholar
Digital Library
- Richard A. Kelsey and Paul Hudak. 1989. Realistic compilation by program transformation. In Proceedings of the Sixteenth Annual ACM Symposium on Principles of Programming Languages (POPL). 281–292. Google Scholar
Digital Library
- Andrew Kennedy. 2007. Compiling with continuations, continued. In Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming (ICFP) (ACM SIGPLAN Notices, Vol. 42, No. 9). 177–190. Google Scholar
Digital Library
- David Kranz, Richard Kelsey, Jonathan Rees, Paul Hudak, James Philbin, and Norman Adams. 1986. ORBIT: An optimizing compiler for Scheme. In Proceedings of the 1986 SIGPLAN Symposium on Compiler Construction (SIGPLAN Notices, Vol. 21, No. 7). 219–233. Google Scholar
Digital Library
- David A. Kranz. 1988. ORBIT: An Optimizing Compiler for Scheme. Ph.D. Dissertation. Computer Science Department, Yale University, New Haven, Connecticut. Research Report 632.Google Scholar
- Kevin Millikin. 2005. A new approach to one-pass transformations. In Trends in Functional Programming Volume 6. Intellect Books, 252–264.Google Scholar
- Gordon D. Plotkin. 1975. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science 1, 2 (Dec. 1975), 125–159. Google Scholar
Cross Ref
- Brian Rabern. 2016. The history of the use of · -notation in natural language semantics. Semantics and Pragmatics 9 (2016), 1–10. Google Scholar
Cross Ref
- John C. Reynolds. 1972. Definitional interpreters for higher-order programming languages. In Proceedings of 25th National ACM Conference. 717–740. Reprinted in LISP and Symbolic Computation, 11 363–397 (1998).Google Scholar
Digital Library
- John C. Reynolds. 1993. The discoveries of continuations. LISP and Symbolic Computation 6, 3/4 (Dec. 1993), 233–247. Special Issue on Continuations (Part I). Google Scholar
Digital Library
- Amr Sabry and Matthias Felleisen. 1993. Reasoning about programs in continuation-passing style. LISP and Symbolic Computation 6, 3/4 (Dec. 1993), 289–360. Special Issue on Continuations (Part I). Google Scholar
Digital Library
- Olin Shivers and David Fisher. 2006. Multi-return function call. Journal of Functional Programming 16, 4/5 (July/September 2006), 547–582. Google Scholar
Digital Library
- Guy L. Steele Jr. 1976. Lambda, the ultimate declarative. AI Memo 379. Artificial Intelligence Laboratory, Massachusetts Institute of Technology, Cambridge, Massachusetts.Google Scholar
- Guy L. Steele Jr. 1978. RABBIT: A Compiler for SCHEME. Master’s thesis. Artificial Intelligence Laboratory, Massachusetts Institute of Technology, Cambridge, Massachusetts. Technical report AI-TR-474.Google Scholar
Digital Library
Index Terms
No-brainer CPS conversion (functional pearl)
Recommendations
Definitional Interpreters for Higher-Order Programming Languages
Higher-order programming languages (i.e., languages in which procedures or labels can occur as values) are usually defined by interpreters that are themselves written in a programming language based on the lambda calculus (i.e., an applicative language ...
Definitional interpreters for higher-order programming languages
ACM '72: Proceedings of the ACM annual conference - Volume 2Higher-order programming languages (i.e., languages in which procedures or labels can occur as values) are usually defined by interpreters which are themselves written in a programming language based on the lambda calculus (i.e., an applicative language ...
Definitional Interpreters Revisited
To introduce the republication of “Definitional Interpreters for Higher-Order Programming Languages”, the author recounts the circumstances of its creation, clarifies several obscurities, corrects a few mistakes, and briefly summarizes some more recent ...






Comments