Results 1  10
of
35
Reasoning about Programs in ContinuationPassing Style
 Lisp and Symbolic Computation
"... Plotkin's v calculus for callbyvalue programs is weaker than the fij calculus for the same programs in continuationpassing style (CPS). To identify the callby value axioms that correspond to fij on CPS terms, we define a new CPS transformation and an inverse mapping, both of which are interes ..."
Abstract

Cited by 161 (13 self)
 Add to MetaCart
Plotkin's v calculus for callbyvalue programs is weaker than the fij calculus for the same programs in continuationpassing style (CPS). To identify the callby value axioms that correspond to fij on CPS terms, we define a new CPS transformation and an inverse mapping, both of which are interesting in their own right. Using the new CPS transformation, we determine the precise language of CPS terms closed under fijtransformations, as well as the callbyvalue axioms that correspond to the socalled administrative fijreductions on CPS terms. Using the inverse mapping, we map the remaining fi and j equalities on CPS terms to axioms on callbyvalue terms. On the pure (constant free) set ofterms, the resulting set of axioms is equivalent to Moggi's computational calculus. If the callbyvalue language includes the control operators abort and callwithcurrentcontinuation, the axioms are equivalent to an extension of Felleisen et al.'s vCcalculus and to the equational subtheory of Talcott's logic IOCC. Contents 1 Compiling with and without Continuations 4 2 : Calculi and Semantics 7 3 The Origins and Practice of CPS 10 3.1 The Original Encoding : : : : : : : : : : : : : : : : : : : : : 10 3.2 The Universe of CPS Terms : : : : : : : : : : : : : : : : : : 11 4 A Compacting CPS Transformation 13
A Generic Account of ContinuationPassing Styles
 Proceedings of the Twentyfirst Annual ACM Symposium on Principles of Programming Languages
, 1994
"... We unify previous work on the continuationpassing style (CPS) transformations in a generic framework based on Moggi's computational metalanguage. This framework is used to obtain CPS transformations for a variety of evaluation strategies and to characterize the corresponding administrative reducti ..."
Abstract

Cited by 87 (34 self)
 Add to MetaCart
We unify previous work on the continuationpassing style (CPS) transformations in a generic framework based on Moggi's computational metalanguage. 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 metalanguage. Mapping terms into the metalanguage captures computational properties (e.g., partiality, strictness) and evaluation order explicitly in both the term and the type structure of the metalanguage. The CPS transformation is then obtained by applying a generic transformation from terms and types in the metalanguage to CPS terms and types, based on a typed term representation of the continuation ...
Representing control: a study of the CPS transformation
, 1992
"... This paper investigates the transformation of v terms into continuationpassing style (CPS). We show that by appropriate jexpansion of Fischer and Plotkin's twopass equational specification of the CPS transform, we can obtain a static and contextfree separation of the result terms into "esse ..."
Abstract

Cited by 81 (7 self)
 Add to MetaCart
This paper investigates the transformation of v terms into continuationpassing style (CPS). We show that by appropriate jexpansion of Fischer and Plotkin's twopass equational specification of the CPS transform, we can obtain a static and contextfree separation of the result terms into "essential" and "administrative" constructs. Interpreting the former as syntax builders and the latter as directly executable code, we obtain a simple and efficient onepass transformation algorithm, easily extended to conditional expressions, recursive definitions, and similar constructs. This new transformation algorithm leads to a simpler proof of Plotkin's simulation and indifference results. Further we show how CPSbased control operators similar to but more general than Scheme's call/cc can be naturally accommodated by the new transformation algorithm. To demonstrate the expressive power of these operators, we use them to present an equivalent but even more concise formulation of t...
Back to Direct Style
, 1994
"... This paper describes the transformation of lambdaterms from continuationpassing style (CPS) to direct style. This transformation is the left inverse of Plotkin's lefttoright callbyvalue CPS encoding for the pure lambdacalculus. Not all terms are CPS terms, and not all CPS terms encode a left ..."
Abstract

Cited by 49 (22 self)
 Add to MetaCart
This paper describes the transformation of lambdaterms from continuationpassing style (CPS) to direct style. This transformation is the left inverse of Plotkin's lefttoright callbyvalue CPS encoding for the pure lambdacalculus. Not all terms are CPS terms, and not all CPS terms encode a lefttoright callbyvalue evaluation. These CPS terms are characterized here; they can be mapped back to direct style. In addition, the two transformations  to continuationpassing style and to direct style  are factored using a language where all intermediate values are named and their computation is sequentialized. The issue of proper tailrecursion is also addressed.
Design and Implementation of Code Optimizations for a TypeDirected Compiler for Standard ML
, 1996
"... Abstract The trends in software development are towards larger programs, more complex programs, and more use of programs as "component software. " These trends mean that the features of modern programming languages are becoming more important than ever before. Programming languages need to ..."
Abstract

Cited by 48 (2 self)
 Add to MetaCart
Abstract The trends in software development are towards larger programs, more complex programs, and more use of programs as "component software. " These trends mean that the features of modern programming languages are becoming more important than ever before. Programming languages need to have features such as strong typing, a module system, polymorphism, automatic storage management, and higherorder functions. In short, modern programming languages are becoming more important than ever before.
A Syntactic Theory of Dynamic Binding
 HigherOrder and Symbolic Computation
, 1997
"... . Dynamic binding, which has always been associated with Lisp, is still semantically obscure to many. Although largely replaced by lexical scoping, not only does dynamic binding remain an interesting and expressive programming technique in specialised circumstances, but also it is a key notion in se ..."
Abstract

Cited by 32 (1 self)
 Add to MetaCart
. Dynamic binding, which has always been associated with Lisp, is still semantically obscure to many. Although largely replaced by lexical scoping, not only does dynamic binding remain an interesting and expressive programming technique in specialised circumstances, but also it is a key notion in semantics. This paper presents a syntactic theory that enables the programmer to perform equational reasoning on programs using dynamic binding. The theory is proved to be sound and complete with respect to derivations allowed on programs in "dynamicenvironment passing style". From this theory, we derive a sequential evaluation function in a contextrewriting system. Then, we exhibit the power and usefulness of dynamic binding in two different ways. First, we prove that dynamic binding adds expressiveness to a purely functional language. Second, we show that dynamic binding is an essential notion in semantics that can be used to define the semantics of exceptions. Afterwards, we further refin...
A rational deconstruction of Landin’s SECD machine
 Implementation and Application of Functional Languages, 16th International Workshop, IFL’04, number 3474 in Lecture Notes in Computer Science
, 2004
"... Abstract. Landin’s SECD machine was the first abstract machine for applicative expressions, i.e., functional programs. Landin’s J operator was the first control operator for functional languages, and was specified by an extension of the SECD machine. We present a family of evaluation functions corre ..."
Abstract

Cited by 27 (19 self)
 Add to MetaCart
Abstract. Landin’s SECD machine was the first abstract machine for applicative expressions, i.e., functional programs. Landin’s J operator was the first control operator for functional languages, and was specified by an extension of the SECD machine. We present a family of evaluation functions corresponding to this extension of the SECD machine, using a series of elementary transformations (transformation into continuationpassing style (CPS) and defunctionalization, chiefly) and their left inverses (transformation into direct style and refunctionalization). To this end, we modernize the SECD machine into a bisimilar one that operates in lockstep with the original one but that (1) does not use a data stack and (2) uses the callersave rather than the calleesave convention for environments. We also identify that the dump component of the SECD machine is managed in a calleesave way. The callersave counterpart of the modernized SECD machine precisely corresponds to Thielecke’s doublebarrelled continuations and to Felleisen’s encoding of J in terms of call/cc. We then variously characterize the J operator in terms of CPS and in terms of delimitedcontrol operators in the CPS hierarchy. As a byproduct, we also present several reduction semantics for applicative expressions
CPS Transformation after Strictness Analysis
 ACM Letters on Programming Languages and Systems
, 1993
"... syntax of the source language ` c : ' f:::; x : ø ; :::g ` x : ø ß ` e : ø !ø ß ` fix e : ø ß [ fx : ø 1 g ` e : ø 2 ß ` x : ø 1 : e : ø 1 !ø 2 ß ` e 0 : ø 1 !ø 2 ß ` e 1 : ø 1 ß ` @ e 0 e 1 : ø 2 ß ` e 1 : ' ß ` e 2 : ø ß ` e 3 : ø ß ` if e 1 then e 2 else e 3 : ø ß ` e 0 : ø 0 ß [ fx : ø 0 g ` ..."
Abstract

Cited by 26 (10 self)
 Add to MetaCart
syntax of the source language ` c : ' f:::; x : ø ; :::g ` x : ø ß ` e : ø !ø ß ` fix e : ø ß [ fx : ø 1 g ` e : ø 2 ß ` x : ø 1 : e : ø 1 !ø 2 ß ` e 0 : ø 1 !ø 2 ß ` e 1 : ø 1 ß ` @ e 0 e 1 : ø 2 ß ` e 1 : ' ß ` e 2 : ø ß ` e 3 : ø ß ` if e 1 then e 2 else e 3 : ø ß ` e 0 : ø 0 ß [ fx : ø 0 g ` e 1 : ø 1 ß ` let x = e 0 in e 1 : ø 1 ß ` e 1 : ø 1 ß ` e 2 : ø 2 ß ` pair e 1 e 2 : ø 1 \Theta ø 2 ß ` e : ø 1 \Theta ø 2 ß ` fst e : ø 1 ß ` e : ø 1 \Theta ø 2 ß ` snd e : ø 2 Fig. 2. Typechecking rules for the source language approach is used by Kesley and Hudak [11] and by Fradet and Le M'etayer [9]. Both include a CPS transformation. Fradet and Le M'etayer compile both CBN and CBV programs by using the CBN and the CBV CPStransformation. Recently, Burn and Le M'etayer have combined this technique with a global programanalysis [2], which is comparable to our goal here. 1.4 Overview Section 2 presents the syntax of the source language and the strictnessannotated language. We c...
The Occurrence of Continuation Parameters in CPS Terms
, 1995
"... We prove an occurrence property about formal parameters of continuations in ContinuationPassing Style (CPS) terms that have been automatically produced by CPS transformation of pure, callbyvalue terms. Essentially, parameters of continuations obey a stacklike discipline. This property was intro ..."
Abstract

Cited by 24 (18 self)
 Add to MetaCart
We prove an occurrence property about formal parameters of continuations in ContinuationPassing Style (CPS) terms that have been automatically produced by CPS transformation of pure, callbyvalue terms. Essentially, parameters of continuations obey a stacklike discipline. This property was introduced, but not formally proven, in an earlier work on the DirectStyle transformation (the inverse of the CPS transformation). The proof has been implemented in Elf, a constraint logic programming language based on the logical framework LF. In fact, it was the implementation that inspired the proof. Thus this note also presents a case study of machineassisted proof discovery. All the programs are available in ( ftp.daimi.aau.dk:pub/danvy/Programs/danvypfenningElf93.tar.gz ftp.cs.cmu.edu:user/fp/papers/cpsocc95.tar.gz Most of the research reported here was carried out while the first author visited Carnegie Mellon University in the Spring of 1993. Current address: Olivier Danvy, Ny Munkeg...
Formalizing Implementation Strategies for FirstClass Continuations
 in [31
, 2000
"... We present the first formalization of implementation strategies for firstclass continuations. The formalization hinges on abstract machines for continuationpassing style (CPS) programs with a special treatment for the current continuation, accounting for the essence of firstclass continuation ..."
Abstract

Cited by 21 (5 self)
 Add to MetaCart
We present the first formalization of implementation strategies for firstclass continuations. The formalization hinges on abstract machines for continuationpassing style (CPS) programs with a special treatment for the current continuation, accounting for the essence of firstclass continuations. These abstract machines are proven equivalent to a standard, substitutionbased abstract machine. The proof techniques work uniformly for various representations of continuations. As a byproduct, we also present a formal proof of the two folklore theorems that one continuation identifier is enough for secondclass continuations and that secondclass continuations are stackable.