## A Generic Account of Continuation-Passing Styles (1994)

Venue: | Proceedings of the Twenty-first Annual ACM Symposium on Principles of Programming Languages |

Citations: | 87 - 34 self |

### BibTeX

@INPROCEEDINGS{Hatcliff94ageneric,

author = {John Hatcliff and Olivier Danvy},

title = {A Generic Account of Continuation-Passing Styles},

booktitle = {Proceedings of the Twenty-first Annual ACM Symposium on Principles of Programming Languages},

year = {1994},

pages = {458--471},

publisher = {ACM Press}

}

### Years of Citing Articles

### OpenURL

### Abstract

We unify previous work on the continuation-passing style (CPS) transformations in a generic framework based on Moggi's computational meta-language. This framework is used to obtain CPS transformations for a variety of evaluation strategies and to characterize the corresponding administrative reductions and inverse transformations. We establish generic formal connections between operational semantics and equational theories. Formal properties of transformations for specific evaluation orders follow as corollaries. Essentially, we factor transformations through Moggi's computational meta-language. Mapping -terms into the meta-language captures computational properties (e.g., partiality, strictness) and evaluation order explicitly in both the term and the type structure of the meta-language. The CPS transformation is then obtained by applying a generic transformation from terms and types in the meta-language to CPS terms and types, based on a typed term representation of the continuation ...

### Citations

1115 |
The Lambda Calculus: Its Syntax and Semantics
- Barendregt
- 1981
(Show Context)
Citation Context ...dentifiers (and where no distinction is necessary) we use the meta-variable x. To simplify substitution, we follow Barendregt's variable convention 3 and consider the quotient ofsunder ff-equivalence =-=[2]. We-=- write e1 j e2 for ff-equivalent terms e1 and e2 . The notation FV(e) denotes 2 We follow Tennent's presentation of abstract syntax based on derivability of sequents of the form \Gamma ` e : �� [4... |

733 | Notions of Computation and Monads
- Moggi
- 1991
(Show Context)
Citation Context ...ppears that many CPS transformations are built from common building blocks. We represent these building blocks abstractly by constructs of Moggi's computational metalanguage (which we refer to assml) =-=[26]-=-. 1 By formally connecting the language of abstract building blocks and the language of CPS terms, we obtain a generic framework for constructing CPS transformations and for reasoning about CPS terms ... |

620 |
Compiling with Continuations
- Appel
- 1992
(Show Context)
Citation Context ...zing. Let N be a function mapping everysml term to its Rmon normal form and let Zv denote a version of Plotkin's call-by-value CPS transformation that carries out administrative reductions on the fly =-=[1, 7, 43]. Pr-=-operty 9 For \Gamma ` e : �� , Zvh[e]i j (C 0 ffi N ffi Ev )h[e]i. A similar property also holds for the corresponding one-pass call-by-name CPS transformation, and for the corresponding CPS trans... |

458 | Comprehending Monads
- Wadler
- 1990
(Show Context)
Citation Context ...use the meta-language is typed, our development also gives a generic account of the typing of CPS transformations. Section 9 relates the present work to other recent applications of Moggi's framework =-=[36, 41, 42]-=-. The rest of the paper is organized as follows. Section 2 addresses the representation of computational properties of -terms withsml terms. We consider in detail the standard call-by-name and call-by... |

440 | Computational lambda-calculus and monads
- Moggi
- 1989
(Show Context)
Citation Context ... as an alternative language to CPS --- very close to CPS but without continuations. 1 Note that Moggi's computational meta-language [26] is a different language than Moggi's computational -calculussc =-=[23, 24]-=-. CBV CBN Reynolds's CBV CBV + strictness info Evaluation Orders - oe - oe - oe - oesml ' & $ % CPS ' & $ % - oe C C \Gamma1 Figure 1: Factoring transformations through the computational meta-language... |

327 |
Denotational Semantics: A Methodology for Language Development
- Schmidt
- 1986
(Show Context)
Citation Context ... the computational properties of call-byvalue, but in a different style than Ev and ER . This corresponds to the style of capturing computational properties of call-by-value in denotational semantics =-=[38]-=-: (1) either using a strictness check in the applicative structure (corresponding to Ev ); (2) or forming strict functions to create a strict function space (corresponding to Reynolds's transformation... |

299 | Definitional interpreters for higher-order programming languages
- Reynolds
- 1972
(Show Context)
Citation Context ...ynolds's notion of trivial and serious expressions is generalized to functions --- functions that always produce values do not need to be passed continuations to achieve evaluation-order independence =-=[9, 33]-=-. Elsewhere [16], we use Moggi's existence predicate [26, Section 2.2] within the meta-language itself to derive such optimizations. 4.6 Other sequencing orders Sincesml makes control flow explicit, o... |

268 | The essence of compiling with continuations
- Flanagan, Sabry, et al.
- 1993
(Show Context)
Citation Context ...s. For each CPS transformation, a corresponding directstyle (DS) transformation exists that maps CPS terms and types to direct-style terms and types. DS transformations have stirred interest recently =-=[6, 10, 13, 36]-=-. However, just like the CPS transformations, they have been studied individually. In contrast, the continuation elimination C \Gamma1 serves as the core of a generic DS transformation. Finally, in si... |

234 | A formulae-as-types notion of control
- Griffin
- 1990
(Show Context)
Citation Context ...le" transformations. Ditto for the continuation/state monad. This investigation should make it possible to come back to Griffin's connection between double-negation translation and CPS transforma=-=tion [14]-=- and to Murthy's intrepid display of continuation-passing styles, from a logical standpoint [28, Chapters 9 & 10]. Griffin identified Plotkin's call-byvalue CPS transformation as a logical embedding. ... |

220 |
Call-by-name, call-by-value, and the #-calculus
- Plotkin
- 1975
(Show Context)
Citation Context ...ructure for all styles. However, in the literature, the formal properties of each style are established independently. For example, in his seminal paper Call-by-name, call-by-value, and the -calculus =-=[32]-=-, Plotkin first presents call-by-value continuation-passing style (CPS) along with a set of correctness proofs and then he presents call-by-name CPS along with another set of correctness proofs. Both ... |

171 |
Semantics of Programming Languages
- Tennent
- 1991
(Show Context)
Citation Context ...2]. We write e1 j e2 for ff-equivalent terms e1 and e2 . The notation FV(e) denotes 2 We follow Tennent's presentation of abstract syntax based on derivability of sequents of the form \Gamma ` e : �=-=� [40]-=-. 3 In terms occurring in definitions and proofs etc., all bound variables are chosen to be different from free variables [2, page 26]. the set of free variables in e and e1 [x := e2 ] denotes the res... |

161 | Reasoning about programs in continuation-passing style
- Sabry, Felleisen
- 1993
(Show Context)
Citation Context ...eful in their own right. Our transformation C \Gamma1 forms the core of a generic DS transformation, thus generalizing previous work in the absence of computational effects other than non-termination =-=[6, 35]. Direct-s-=-tyle transformations D are obtained by composing "inverse" encodings E \Gamma1 (mappingsml terms to direct-stylesterms) with the transformation C \Gamma1 . D def = E \Gamma1 ffi C \Gamma1 Th... |

105 |
Danvy and Andrzej Filinski. Representing control: A study of the CPS transformation
- Olivier
- 1992
(Show Context)
Citation Context ...transformations capturing mixed evaluation orders based on strictness and totality information [3, 8, 9]. Practical use of CPS transformations requires one to characterize "administrative reducti=-=ons" [7, 32, 36]. Again, a-=-dministrative reductions are usually characterized for each CPS transformation individually. For example, Plotkin gives a "colon-translation" that performs administrative reductions for call... |

100 | Lambda calculus schemata
- Fischer
- 1972
(Show Context)
Citation Context ...her than from any deliberate structural connection with e.g., the CPS monad. For example, the terms produced by Sabry and Felleisen's CPS transformation (a curried version of Fischer's transformation =-=[12]-=-, where continuations occur first in functions) do not have the fundamental computational structure dictated by Moggi's framework. This is most easily seen by observing the mismatch between the typing... |

83 |
Control operators, the SECD machine and the -calculus
- Felleisen, Friedman
- 1986
(Show Context)
Citation Context ...ext before it is contracted. Omitting the let.assoc reduction gives the characteristic "direct-style" evaluation pattern where the evaluator descends into a context to pick the next redex to=-= contract [11]. The following prop-=-erty captures the fact that the "directstyle " and the "continuation-passing style" evaluation patterns give the same results forsml programs. 7 Moggi gives a categorical semantics... |

75 |
The theory and practice of transforming call-by-need into call-by-value
- Mycroft
- 1980
(Show Context)
Citation Context ...). 4.4 Mixed evaluation strategies based on strictness information Compile-time analyses of computation properties (such as strictness analysis) indicate where it is safe to mix evaluation strategies =-=[29]-=-. Earlier works show how to derive the corresponding CPS transformation encoding the mixed evaluation strategy into CPS terms [3, 8, 28, 31]. Such transformations can be correctly constructed by an en... |

67 | Continuation semantics in typed lambda calculi (summary
- Meyer, Wand
- 1985
(Show Context)
Citation Context ...sformations Kn and Kv constructed above are actually Plotkin's CPS transformations. Let Pn and Pv respectively denote the typed version of Plotkin's call-by-name and call-by-value CPS transformations =-=[8, 15, 22]. Pr-=-operty 8 For \Gamma ` e : �� , Pnh[e]i j Knh[e]i Pv h[e]i j Kv h[e]i Proof: by structural induction over e. Thus, the construction and correctness (specifically, the Simulation and Indifference th... |

63 |
Extracting constructive content from classical proofs
- Murthy
- 1990
(Show Context)
Citation Context ...ness analysis) indicate where it is safe to mix evaluation strategies [29]. Earlier works show how to derive the corresponding CPS transformation encoding the mixed evaluation strategy into CPS terms =-=[3, 8, 28, 31]-=-. Such transformations can be correctly constructed by an encoding that contains both call-by-value-like (capturing strictness) and call-by-name-like (capturing non-strictness) applications /functions... |

51 | Back to direct style II: First–class continuations
- Danvy, Lawall
- 1992
(Show Context)
Citation Context ...s. For each CPS transformation, a corresponding directstyle (DS) transformation exists that maps CPS terms and types to direct-style terms and types. DS transformations have stirred interest recently =-=[6, 10, 13, 36]-=-. However, just like the CPS transformations, they have been studied individually. In contrast, the continuation elimination C \Gamma1 serves as the core of a generic DS transformation. Finally, in si... |

46 |
On the relation between direct and continuation semantics
- Reynolds
- 1974
(Show Context)
Citation Context ...izes Plotkin's construction and correctness proofs for his call-by-value and call-by-name CPS transformations [32]. It also generalizes similar results for Reynolds's call-by-value CPS transformation =-=[34]-=-, and more recently for CPS transformations capturing mixed evaluation orders based on strictness and totality information [3, 8, 9]. Practical use of CPS transformations requires one to characterize ... |

35 | Polymorphic type assignment and CPS conversion
- Harper, Lillibridge
- 1993
(Show Context)
Citation Context ...sformations Kn and Kv constructed above are actually Plotkin's CPS transformations. Let Pn and Pv respectively denote the typed version of Plotkin's call-by-name and call-by-value CPS transformations =-=[8, 15, 22]. Pr-=-operty 8 For \Gamma ` e : �� , Pnh[e]i j Knh[e]i Pv h[e]i j Kv h[e]i Proof: by structural induction over e. Thus, the construction and correctness (specifically, the Simulation and Indifference th... |

34 |
Correctness of procedure representations in higher-order assembly language
- Wand
- 1991
(Show Context)
Citation Context ...zing. Let N be a function mapping everysml term to its Rmon normal form and let Zv denote a version of Plotkin's call-by-value CPS transformation that carries out administrative reductions on the fly =-=[1, 7, 43]. Pr-=-operty 9 For \Gamma ` e : �� , Zvh[e]i j (C 0 ffi N ffi Ev )h[e]i. A similar property also holds for the corresponding one-pass call-by-name CPS transformation, and for the corresponding CPS trans... |

26 | CPS transformation after strictness analysis - Danvy, Hatcliff - 1993 |

22 |
Thunks: a way of compiling procedure statements with some comments on procedure declarations
- Ingerman
- 1961
(Show Context)
Citation Context ...n ( x E R h[�� ]i : ERh[e]i) [x1] Instead of arguments being evaluated in the application (as in Figure 8, the call-by-value encoding intosml ), they are passed as computations (essentially as thu=-=nks [17, 18]-=-), evaluated immediately after the function is applied, and the resulting values are wrapped up again as thunks. Thus, ER captures the computational properties of call-by-value, but in a different sty... |

17 | Call-by-need and continuationpassing style
- Okasaki, Lee, et al.
- 1994
(Show Context)
Citation Context ...ness analysis) indicate where it is safe to mix evaluation strategies [29]. Earlier works show how to derive the corresponding CPS transformation encoding the mixed evaluation strategy into CPS terms =-=[3, 8, 28, 31]-=-. Such transformations can be correctly constructed by an encoding that contains both call-by-value-like (capturing strictness) and call-by-name-like (capturing non-strictness) applications /functions... |

15 | Proving the correctness of compiler optimisations based on a global analysis
- Burn, M'etayer
(Show Context)
Citation Context ...eralizes similar results for Reynolds's call-by-value CPS transformation [34], and more recently for CPS transformations capturing mixed evaluation orders based on strictness and totality information =-=[3, 8, 9]. Practica-=-l use of CPS transformations requires one to characterize "administrative reductions" [7, 32, 36]. Again, administrative reductions are usually characterized for each CPS transformation indi... |

14 | On the transformation between direct and continuation semantics, in
- Danvy, Hatcliff
- 1993
(Show Context)
Citation Context ...eralizes similar results for Reynolds's call-by-value CPS transformation [34], and more recently for CPS transformations capturing mixed evaluation orders based on strictness and totality information =-=[3, 8, 9]. Practica-=-l use of CPS transformations requires one to characterize "administrative reductions" [7, 32, 36]. Again, administrative reductions are usually characterized for each CPS transformation indi... |

13 | Separating stages in the continuation-passing style transformation
- Lawall, Danvy
- 1993
(Show Context)
Citation Context ..., and for the corresponding CPS transformations after static analyses [8, 9, 31]. This staging and the account of administrative reductions prior to introducing continuations have been recently noted =-=[5, 6, 13, 21, 36]-=-. Typically, CPS transformations are factored into three distinct steps: 1. naming intermediate values (captured by E); 2. flattening nested let's (captured by N ); and 3. introducing continuations (c... |

12 | Three Steps for the CPS Transformation
- Danvy
- 1991
(Show Context)
Citation Context ..., and for the corresponding CPS transformations after static analyses [8, 9, 31]. This staging and the account of administrative reductions prior to introducing continuations have been recently noted =-=[5, 6, 13, 21, 36]-=-. Typically, CPS transformations are factored into three distinct steps: 1. naming intermediate values (captured by E); 2. flattening nested let's (captured by N ); and 3. introducing continuations (c... |

12 | Reasoning about explicit and implicit representations of state - Sabry, Field - 1993 |

11 |
to direct style. Science of Computer Programming
- Back
- 1994
(Show Context)
Citation Context ...s. For each CPS transformation, a corresponding directstyle (DS) transformation exists that maps CPS terms and types to direct-style terms and types. DS transformations have stirred interest recently =-=[6, 10, 13, 36]-=-. However, just like the CPS transformations, they have been studied individually. In contrast, the continuation elimination C \Gamma1 serves as the core of a generic DS transformation. Finally, in si... |

9 |
Thunks and the -calculus
- Hatcliff, Danvy
- 1997
(Show Context)
Citation Context ...n ( x E R h[�� ]i : ERh[e]i) [x1] Instead of arguments being evaluated in the application (as in Figure 8, the call-by-value encoding intosml ), they are passed as computations (essentially as thu=-=nks [17, 18]-=-), evaluated immediately after the function is applied, and the resulting values are wrapped up again as thunks. Thus, ER captures the computational properties of call-by-value, but in a different sty... |

9 |
The essence of functional programming (tutorial
- Wadler
- 1992
(Show Context)
Citation Context ...use the meta-language is typed, our development also gives a generic account of the typing of CPS transformations. Section 9 relates the present work to other recent applications of Moggi's framework =-=[36, 41, 42]-=-. The rest of the paper is organized as follows. Section 2 addresses the representation of computational properties of -terms withsml terms. We consider in detail the standard call-by-name and call-by... |

5 | Sound Rules for Parallel Evaluation of a Functional Language with callcc - Moreau, Ribbens - 1993 |

4 |
Proofs by structural induction using partial evaluation
- Lawall
- 1993
(Show Context)
Citation Context ... 2. flattening nested let's (captured by N ); and 3. introducing continuations (captured by C). The last step is provably reversible, and Lawall automated that proof for another meta-language thansml =-=[20]-=-. Recently, Sabry and Felleisen have identified an additional optimization made possible by administrative reductions on call-by-value CPS terms [36]. The optimization corresponds to relocating evalua... |

2 |
Forthcoming
- Hatcliff
- 1994
(Show Context)
Citation Context ...e evaluation. due to the generalized notion of value, but it is a conservative extension of Rn and Rv . Section 4.5 gives an application of this generalized notion of value. The reader is referred to =-=[16]-=- for a detailed discussion. 4 CPS Transformations from Encodings of Computational Properties Previous applications ofsml focus exclusively on call-byvalue or call-by-name [26, 42]. In contrast, the pr... |

2 |
Forthcoming
- Lawall
- 1994
(Show Context)
Citation Context ...ucts --- thus collapsing values and computations, under some side-conditions ensuring that the resulting terms remain evaluated in the same order. This is the technique used by e.g., Lawall and Danvy =-=[6, 10, 19, 21]-=-. Alternatively, one may adapt the techniques of Sabry and Felleisen [36] and map reduction contexts to evaluation contexts in . In general, transformations E \Gamma1 defined as above are meaning-pres... |

2 |
An abstract view of programming languages. Course Notes
- Moggi
- 1989
(Show Context)
Citation Context ...ntations of state, in a typed setting. In particular, we are currently investigating how the continuation /state monad (obtained e.g., by applying the statemonad constructor to the continuation monad =-=[25]-=-) offers a generic relation between implicit and explicit representations of both control and state. We are also considering to add computational effects on control (first-class continuations) and on ... |

2 |
Naur (editor). Revised report on the algorithmic language Algol 60
- Peter
- 1962
(Show Context)
Citation Context ...pped up again as thunks. Thus, ER captures the computational properties of call-by-value, but in a different style than Ev . This corresponds to the definition of call-by-value in the Algol 60 report =-=[30]. Turnin-=-g to the CPS transformation, Rv def = C 0 ffi ER Griffin, for example [15, Footnote 3], pointed out that the typing of the function space in Rv matches the one of Pn i.e., Rvh��1 !��2 i = Rvh[... |