Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/155090.155113acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
Article
Free access

The essence of compiling with continuations

Published: 01 June 1993 Publication History

Abstract

In order to simplify the compilation process, many compilers for higher-order languages use the continuation-passing style (CPS) transformation in a first phase to generate an intermediate representation of the source program. The salient aspect of this intermediate form is that all procedures take an argument that represents the rest of the computation (the “continuation”). Since the nai¨ve CPS transformation considerably increases the size of programs, CPS compilers perform reductions to produce a more compact intermediate representation. Although often implemented as a part of the CPS transformation, this step is conceptually a second phase. Finally, code generators for typical CPS compilers treat continuations specially in order to optimize the interpretation of continuation parameters.
A thorough analysis of the abstract machine for CPS terms show that the actions of the code generator invert the nai¨ve CPS translation step. Put differently, the combined effect of the three phases is equivalent to a source-to-source transformation that simulates the compaction phase. Thus, fully developed CPS compilers do not need to employ the CPS transformation but can achieve the same results with a simple source-level transformation.

References

[1]
AHO, A., SETHI, R., AND ULLMAN, J. Compilers--Pmnciples, Techniques, and Tools. Addison-Wesley, Reading, Mass., 1985.
[2]
APPEL, A. Compiling with Continuations. Cambridge University Press, 1992.
[3]
BARENDREGT, H. The Lambda Calculus: Its $yntaz and Semantics, revised ed. Studies in Logic and the Foundations of Mathematics 103. North- Holland, 1984.
[4]
BOEHM, H.-J., AND DC~MERS, A. Implementing Russel. In Proceedzngs of the A CM SIG- PLAN 1986 Symposzum on Compiler Constructzon (1986), vol. 21(7), Sigplan Notices, pp. 186-195.
[5]
BONDOaF, A. Improving binding times without explicit CPS-conversion. in Proceedings of the 1992 A CM Conference on L~sp and Functional Programm2ng (1992), pp. 1-10.
[6]
CLINGEa, W. The Scheme 311 compiler: An exercise in denotational semantics. In Proceedings of the 198J A CM Conference on L~sp and Functional Programmzng (1984), pp. 356-364.
[7]
DANVY, O. Back to direct style. In Proceedings of the Jth European Symposium on Programming (Rennes, 1992), Lecture Notes in Computer Science, 582, Springer Verlag, pp. 130-150.
[8]
DANVY, O. Three steps for the CPS transformation. Tech. l~ep. CIS-92-2, Kansas State University, 1992.
[9]
DANVY, O., AND FILiNSKI, A. Representing control: A study of the CPS transformation. Mathematical Structures in Computer Science, 4 (1992), 361-391.
[10]
FELLE~SEN, M., AND FRIEDMAN, D. Control operators, the SECD-machine, and the A-calculus. In Formal Description of Programming Concepts III (Amsterdam, 1986), M. Wirsing, Ed., Elsevier Science Publishers B.V. (North-Holland), pp. 193- 217.
[11]
FESSENDEN, C., CLINGER, W., FRIEDMAN, D. P., AND HAYNES, C. T. Scheme 311 version 4 reference manual. Computer Science Technical Report 137, indiana University, Bloomington, Indiana, Feb. 1983.
[12]
FISCHER, M. Lambda calculus schemata. In Proceedings of the A CM Conference on Proving Assertions About Programs (1972), vol. 7(1), Sigplan Notices, pp. 104-109.
[13]
KELSEY, R., AND HUDAK, P. Realistic compilation by program transformation. In Conference Record of the 16th Annual ACM Symposium on Principles of Programming Languages (Austin, TX, Jan. 1989), pp. 281-292.
[14]
KaANZ, D., KELSEY, R., REES, J., HUDAK, P., PmLnIr~, J., ^rqD ADAMS, N. Orbit: An optimizing compiler for Scheme. In Proceedings of the A CM $IGPLAN 1986 Symposium on Compiler Construction (1986), vol. 21(7), Sigplan Notices, pp. 219-233.
[15]
LEROY, X. The Zinc experiment: An economical implementation of the ML language. Tech. Rep. 117, INRIA, 1990.
[16]
PLOTKIN, G. Call-by-name, call-by-value, and the A-calculus. Theoretical Computer Science i (1975), 125-159.
[17]
SABRY, A., AND FELLEISEN, M. Reasoning about programs in continuation-passing style. In Proceed~ngs of the 1992 A CM Conference on Lisp and Functional Programming (1992), pp. 288-298. Technical Report 92-180, Rice University.
[18]
SHIVEr. S, O. Control-Flow Analysis of Higher- Order Languages or Tamzng Lambda. PhD thesis, Carnegie-Mellon University, 1991.
[19]
STEELE, G. L. RABBIT: A compiler for Scheme. MIT AI Memo 474, Massachusetts Institute of Technology, Cambridge, Mass., May 1978.
[20]
WAND, M. Correctness of procedure representations in higher-order assembly language. In Proceedings of the 1991 Conference on the Mathematical Foundations of Programing Semantics (1992), S. Brookes, Ed., vol. 598 of Lecture Notes,n Computer Science, Springer Verlag, pp. 294-311.
[21]
WE~SE, D. Advanced compiling techniques. Course Notes at Stanford University, 1990.

Cited By

View all
  • (2024)Lexical Effect Handlers, DirectlyProceedings of the ACM on Programming Languages10.1145/36897708:OOPSLA2(1670-1698)Online publication date: 8-Oct-2024
  • (2024)Law and Order for Typestate with BorrowingProceedings of the ACM on Programming Languages10.1145/36897638:OOPSLA2(1475-1503)Online publication date: 8-Oct-2024
  • (2024)A Low-Level Look at A-Normal FormProceedings of the ACM on Programming Languages10.1145/36897178:OOPSLA2(165-191)Online publication date: 8-Oct-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PLDI '93: Proceedings of the ACM SIGPLAN 1993 conference on Programming language design and implementation
August 1993
313 pages
ISBN:0897915984
DOI:10.1145/155090
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 June 1993

Permissions

Request permissions for this article.

Check for updates

Qualifiers

  • Article

Conference

PLDI93
Sponsor:

Acceptance Rates

Overall Acceptance Rate 406 of 2,067 submissions, 20%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)14,240
  • Downloads (Last 6 weeks)709
Reflects downloads up to 16 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Lexical Effect Handlers, DirectlyProceedings of the ACM on Programming Languages10.1145/36897708:OOPSLA2(1670-1698)Online publication date: 8-Oct-2024
  • (2024)Law and Order for Typestate with BorrowingProceedings of the ACM on Programming Languages10.1145/36897638:OOPSLA2(1475-1503)Online publication date: 8-Oct-2024
  • (2024)A Low-Level Look at A-Normal FormProceedings of the ACM on Programming Languages10.1145/36897178:OOPSLA2(165-191)Online publication date: 8-Oct-2024
  • (2024)Statically and Dynamically Delayed Sampling for Typed Probabilistic Programming LanguagesProceedings of the 17th ACM SIGPLAN International Conference on Software Language Engineering10.1145/3687997.3695634(157-170)Online publication date: 17-Oct-2024
  • (2024)The logical essence of call-by-name CPS translationsProceedings of the 26th International Symposium on Principles and Practice of Declarative Programming10.1145/3678232.3678241(1-12)Online publication date: 9-Sep-2024
  • (2024)Closure-Free Functional Programming in a Two-Level Type TheoryProceedings of the ACM on Programming Languages10.1145/36746488:ICFP(659-692)Online publication date: 15-Aug-2024
  • (2024)On the Operational Theory of the CPS-Calculus: Towards a Theoretical Foundation for IRsProceedings of the ACM on Programming Languages10.1145/36746308:ICFP(147-176)Online publication date: 15-Aug-2024
  • (2024)A HAT Trick: Automatically Verifying Representation Invariants using Symbolic Finite AutomataProceedings of the ACM on Programming Languages10.1145/36564338:PLDI(1387-1411)Online publication date: 20-Jun-2024
  • (2024)Mechanizing Refinement TypesProceedings of the ACM on Programming Languages10.1145/36329128:POPL(2099-2128)Online publication date: 5-Jan-2024
  • (2024)A Tensor Algebra Compiler for Sparse DifferentiationProceedings of the 2024 IEEE/ACM International Symposium on Code Generation and Optimization10.1109/CGO57630.2024.10444787(1-12)Online publication date: 2-Mar-2024
  • Show More Cited By

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media