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 )
References in periodicals archive ?
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.
Sometimes, transformation to continuation-passing style makes programs specialize better [Consel and Danvy 1991].
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.
Continuation-passing style is meant to approximate the operation of a von Neumann computer; a "function" in machine language is just an address in the executable program, perhaps with some convention about which registers hold the parameters--very much like a "jump with arguments.
Rabbit [Steele 1978] is the first compiler that uses the continuation-passing style as the intermediate language; it is also the first compiler that represents the stack frames as continuation closures.
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 program in continuation-passing style, will benefit from the extra precision of the 0CFA analysis.
programs in continuation-passing style, are expensive to analyze with 0CFA.