Continuation Passing Style

(redirected from Continuation-passing style)
Also found in: Wikipedia.

Continuation Passing Style

(CPS) A semantically clean language with continuations used as an intermediate language for Scheme and the SML/NJ compiler.

["Rabbit: A Compiler for Scheme", G.L. Steele, AI-TR-474, MIT (May 1978)].

["Compiling With Continuations", A. Appel, Cambridge U Press 1992].

continuation passing style

(CPS) A style of programming in which every user function f takes an extra argument c known as a continuation. Whenever f would normally return a result r to its caller, it instead returns the result of applying the continuation to r. The continuation thus represents the whole of the rest of the computation. Some examples:

normal (direct style) --> continuation passing

square x = x * x square x k = k (x*x)

g (square 23) square 23 g

(square 3) + 1 square 3 ( \ s . s+1 )
This article is provided by FOLDOC - Free Online Dictionary of Computing (
References in periodicals archive ?
One of the most devastating transformations for the Tofte-Talpin type system is the continuation-passing style (CPS) transformation; each successive computation is placed in the scope of all previous computations, with the result that no regions can be deallocated until the entire computation has been completed.
Therefore, the most elegant and natural form for the language is continuation-passing style (CPS) [Reynolds 1972].
This and similar scenarios were among the main motivations for choosing a continuation-passing style language.
The customer-passing style supported by actors is the concurrent generalization of continuation-passing style supported in sequential languages such as Scheme.
The first step transforms the direct-style parser into continuation-passing style as in Leermakers [1993].
Figure 3 shows the result of transforming the direct-style specification of LR parsing from Figure 1 to continuation-passing style [Reynolds 1972; Plotkin 1975; Fischer 1993; Danvy and Filinski 1992].
Direct-style functional LR,(k) parser after transformation to continuation-passing style.
Before a function call occurs, context information is saved from registers into a "frame." In a compiler based on Continuation-Passing Style (CPS), this frame is the closure of a continuation function [Steele 1978].
Continuation-Passing Style (CPS) is a subset of [Lambda]-calculus, but which closely reflects the control-flow and data-flow operations of a von Neumann machine.
The normalized language is a hybrid language similar to continuation-passing style (CPS) and A-normal form [Flanagan et al.
The machine does not need to maintain a continuation because NCS programs are in continuation-passing style.
A generic account of continuation-passing styles. In 21st Symposium on Principles of Programming Languages (Portland, OR, Jan.), ACM, New York.