| Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992. |
....)s1 MN = #ks1 .M(#ms2 .N(#ns3.mkns3 )s2 )s1 call cc = #k1s1 .k1 (#k2fs2 .fk2 (#k3xs3 . k2 xs3 )s2 )s1 In particular, the type variable # could itself be specialized to continuation type, giving us composable continuations in the style that Danvy and Filinski call meta continuation passing style [7]. Using the answer type polymorphism, we can in fact switch to meta continuation passing style locally, each time an effect is masked, as we do in our next CPS transform. Definition 4.4 The e#ect based CPS transform [ is defined as follows: x] #k.kx [ #x.M ] #k1 .k1 (#k2x. M ] k ....
....[ x] #k.kx [ #x.M ] #k1 .k1 (#k2x. M ] k 2 ) MN ] M ] #m. N ] #n.mkn) call cc] #k1 . k1 (#k2f.fk2 (#k3x.k2x) newreg M ] M ] #xs.sx) The application to (#xs.sx) in the clause for [ newreg M ] is related to Danvy and Filinki s shift and reset control operators [7]. We have not considered the issue of administrative reductions, but it would be straightforward to modify the transform in the light of Danvy and Nielsen s one pass CPS transform [8] to avoid generating administrative redexes, which could be done by adding subclauses for values in ....
[Article contains additional citation context not shown here]
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....application (g # a # 1 . a # n k) to its curried form ( g # a # 1 ) a # 2 ) a # n ) k) would destroy the safety we are trying to achieve. Further simplifications to our transformation are indeed possible, but they require use of more global information about the expression (see [7, 33]) #[p] df # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # (#k . k p) if p (#k . k #[p] if p is a lambda abstraction; #k . #[a 1 ] #a # ....
Danvy, Olivier and Filinski, Andrzej. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2, 4 (December 1992) 361--391.
....we give several examples of what eta expansion achieves and why it works. In Section 3 we present a binding time analysis that inserts etaredexes automatically using two coercion rules, and we show that it transforms Plotkin s CPS transformation into the improved form studied by Danvy and Filinski [8]. 2 The essence of eta expansion We show three examples, where a number occurs both in a static and in a dynamic context, a higher order value occurs both in a static and in a dynamic context, and a function is applied to both a static and a dynamic higher order argument. After the ....
.... Example: the CPS transformation Let us now turn to the transformation of # terms into continuation passing style (CPS) This example is significant because historically, the virtue of eta redexes became apparent in connection with partial evaluation of CPS interpreters and with CPS transformers [3, 8]. It also has practical interest since the pattern of construction and use of higher order values in the CPS transform is prototypical. The first part of Figure 2 displays Plotkin s original CPS transformation for the call by value lambda calculus [21] written as a two level term. Before ....
[Article contains additional citation context not shown here]
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
....is similar to Landin s J operator, Reynolds s escape operator, or call cc as found in Scheme [13] or SML NJ [5] This increases the programmer s power of expression greatly, though the resulting programs are sometimes rather devious. Composable continuations, as devised by Danvy and Filinski [2, 3, 4], support additional operations shift and reset . These even further increase the programmer s power of expression, and can result in programs of mind boggling deviousness. The operations shift and reset are similar to, but not the same as, the operations control and prompt of ....
Danvy, O. and Filinski, A. Representing control. Mathematical Structures in Computer Science, 2, 4 (December 1992).
....Ax.M Aks.k(Ak2xs2.Mk2s2)s MN Aks. Ams2. Ansa.mknsa)s2)s caZZ cc Aks.k(Ak2fs2.fk2(Ak3xs3.k2xs3)s2)s In particular, the type variable fi could itself be specialized to continuation type, giving us composable continuations in the style that Danvy and Filinski call meta continuation passing style [7]. Using the answer type polymorphism, we can in fact switch to meta continuation passing style locally, each time an effect is masked, as we do in our next CPS transform. Definition 4.4 The effect based CPS transform [ is de fined as follows: can cc] k.k (k2. k2) ....
....Definition 4.4 The effect based CPS transform [ is de fined as follows: can cc] k.k (k2. k2) A . N] 0) Ak.k ( Ak2f . f k2( Akgx.k2x) As. The application to (Xxs.sx) in the clause for [ nevreg M] is related to Danvy and Filinki s sht and reset control operators [7]. We have not considered the issue of adminis trative reductions, but it would be straightforward to modify the transform in the light of Danvy and Nielsen s one pass PS transform [8] to avoid generating administrative re dexes, which could be done by adding subclauses for values in ....
[Article contains additional citation context not shown here]
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361 391, December 1992.
....Figure 2: CPS transformer written in CPS gensym) A trick is used to turn a dynamic continuation into a static continuation v: k v to make all the continuations passed to C1 become static. It enables one pass CPS transformation without producing the so called administrative redexes [7]. The transformation of an application proceeds by rst transforming its function and argument. Then, their results are collected to produce an application expression. The result of the application is given a fresh name t , which is passed to the rest of the transformation. The rule for k: M ....
....(k2 t2) Here, the captured continuation k is represented as ( f ) lambda (t) k2 t) and is expanded twice. The two administrative redexes ( lambda (t) k2 t) and (lambda (t2) k2 t2) could be removed during partial evaluation if we used more carefully designed CPS transformation [7]. Let us now partially evaluate the string matcher match with respect to a known pattern ( a b) c) go1 (lambda (l) match ( a b) c) l) lambda (l) lambda (k) k (begin (if (null l) no (if (eq a (car l) if (null (cdr l) no (if (eq c (car (cdr l) if ....
Danvy, O., and A. Filinski \Representing Control, a Study of the CPS Transformation," Mathematical Structures in Computer Science, Vol. 2, No. 4, pp. 361-391 (December 1992).
....t of removing raise handle expressions. Indeed, every expression becomes a higher order function application that receives two functions (continuations) At this stage, two orthogonal optimizations can take place: We can perform administrative reductions, e.g. during the CPS transformation [DF92] We can selectively apply the CPS transformation by exploiting the results of Yi and Ryu s exception analysis [YR97] The point is that an exception analysis tells us a conservative approximation of which expressions may raise an uncaught exception when they are evaluated and of which ....
....6.1 Sharing transducers We tested our transformation for the subst function of Figure 2, i.e. a sharing transducer implementing substitution with exceptions. Figure 11 displays the transformed program, which results from our one pass selective CPS transformer ( a la Danvy and Filinski [DF92] Figure 12 shows (in solid line) that the transformed program can run with almost twice the speed of the original exception based substitution program. As Graph (b) shows, if the program does not raise exceptions (hence handlers are not used) then the transformed program and the ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361-391, December 1992.
....these code pieces at the corresponding component type and tupling the results. One approach to handling sum types and call by value languages is to implement the reflection function by manipulating the code generation context. This has been achieved by using the control operators shift and reset [9, 12]. Section 4.4 gives a more detailed treatment of dealing with sum types and call by value languages in TDPE. An implementation of Full TDPE is described in Danvy s lecture notes [8] The relevance of Full TDPE in this article is that (1) it is the partial 9 signature EXP = term ....
....up to the closest delimiter reset and passes it to its argument, which can then invoke this delimited evaluation context just like a normal function. Formally, Danvy and Filinski introduced the semantics of shift and reset in terms of the CPS transformation (Figure 13; see Danvy and Filinski [9] and Filinski [12] for more details) shift E ] # #. E ] # f.f(# v.# # # .# # (# v) #x.x) reset#E #] # #.#( E ] #x.x) Figure 13: The CPS semantics of shift reset With the help of these control operators, Danvy s treatment [5] achieves the task of let insertion ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....such translations in fact appeared in [7] 1.4. DiOEculties with dependent types Recall Plotkin s translation in Figure 1. The translation is dened by induction over the structure (or alternatively, the size) of terms. This method of denition scales up to richer languages that are either untyped [18, 58] or typed using a iCurry stylej type system [35, 39] i.e. a type system in which the terms are the untyped terms possibly extended with other forms such as conditionals, or control operators as in the language . However, as mentioned in the preceding two subsections, we are interested in ....
....O C : K = O : y:y C hCi K) Figure 8. Optimizing CPS translation for the Domain free cube (excerpts) Most practical applications of CPS (such as compiling and partial evaluation) use an optimizing version of a particular CPS translation that produces terms with fewer administrative redexes [18, 26, 52, 58, 66]. In this section, we present an optimizing version of the translation in Figure 7 that yields terms in administrative normal form (i.e. the terms contain no administrative redexes) We need to consider the CPS translation of objects only, since continuations are introduced only in this ....
O. Danvy and A. Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361391, December 1992.
....component, reflecting these code pieces at the corresponding component type and tupling the results. Sum types and call by value languages can be handled by manipulating the code generation context in the reflection function. This has been achieved by using the control operators shift and reset [9, 14]. Section 4.5 describes in more detail the treatment of sum types and call by value languages in TDPE. Figure 6 on page 16 displays the signature CTRL of control operators and the skeleton of a functor makeFullNbE that is used to implement Full TDPE an implementation can be found in Danvy s ....
....the need to insert a let construct, it usually is not at a point where a let construct can be inserted, i.e. a code generating expression. Using a technique that originated in continuation based partial evaluation [24] Danvy [4] solves this problem by using the control operators shift and reset [9]: Intuitively speaking, the operator shift abstracts the current evaluation context up to the closest delimiter reset and passes the abstracted context to its argument, which can then invoke this delimited evaluation context just like a normal function. Formally, the semantics of shift and reset ....
[Article contains additional citation context not shown here]
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....e ects. This is because computation which is carried out exactly once under a call by value regime may either not be carried out at all or be carried out several times. Dynamic let insertion [7, 37, 44] solves this problem it can be implemented using control operators such as shift and reset [20, 24]. 3.2.8 The Status Quo of TDPE TDPE o ers two main advantages. Firstly, it is very ecient in an application to compiling actions [21] by partially evaluating an interpreter for Action Semantics [51] TDPE performed substantially better than a syntax directed technique. Secondly, the ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361-391, December 1992.
.... (Var m) Ccp [ t 1 ] Ccp [ App t 1 t 2 ] Ccp [ t 1 ] x : Ccp [ t 2 ] y : App Pi x y) Ccp [ Let v t 1 t 2 ] Ccp [ t 1 ] x : Let m Fresh (Let v (Var Pi m) Let Pi (Var m) x (Ccp [ t 2 ] Figure 8: Cps cogen The j expansions used here resemble the j conversions used in [DF92] to separate administrative from nonadministrative continuations in cps transformation. Also, similar j conversions were used for binding time improvements in [Bon91] We note that expression Lam n ( Var n) in the App rule generates continuations that are present in the programs ....
Olivier Danvy and Andrzej Filinski. Representing control. Mathematical Structures in Computer Science, 2(4), 1992.
....of section 6. callcc is given the role of both marking the dynamic extent and capturing a continuation: therefore, after capturing a continuation, the mark of the dynamic extent has disappeared. Optimised CPS translations were proposed by Sabry and Felleisen [26] 27] Danvy and Filinski [3]. For the purpose of the proof, we had to specialise our CPS translation but the applicability of this approach in other circumstances does not appear to be immediate. The mechanism of prompt introduced in section 6 is essentially di erent from Felleisen s prompt [4] or Danvy and Filinski s ....
....proofs, to Olivier Danvy for reading an earlier version of this paper, to the anonymous referees for their comments, to Amr Sabry and Matthias Felleisen for an encouraging discussion in a Chinese co ee shop in SF. A The optimised cps translation As observed by Plotkin [21] by Danvy and Filinski [3] and by Sabry and Felleisen [26] the CPS translation introduces administrative redices. Indeed, for a standard reduction in the call by value calculus, M0 7 v M1 , we have a sequence of administrative reductions, followed by a reduction M 0 0 M 0 1 which corresponds to the original ....
[Article contains additional citation context not shown here]
Olivier Danvy and Andrzej Filinski. Representing Control. A Study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361-391, 1992. 10
....meta function says what to do with the sequence of names. The translations for declarations (D) and function or case rules (R) are direct style and straightforward. This style of translation algorithm, which works in one pass and generates no unnecessary fresh names, is due to Danvy and Filinski [15]. As an example, Figure 17 shows the SIL form of the foldl0, reverse and doit functions from the monomorphic version (Figure 12) of our running example from Section 2. The semantic correctness of the transformation is straightforward to prove. The one significant detail to be checked is that ....
O. Danvy and A. Filinski. Representing control, a study of the cps transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992. 54
....Functional for Typed calculus [7] It is essentially type directed j expansion followed by fi reduction on certain terms. Quite independently of [7] j expansion has been studied for its use in Partial Evaluation, where among other things it has been used to obtain a one pass CPS transformer [20]. It is some of the consequences of this coincidence [19] that are described in the following. Our approach will be purely syntactical and it is hoped that it marks a simplification on earlier treatments of the materiel. We have tried presenting the materiel based purely on the standard reduction ....
....language 1 type directed, two level j expansion combined with full, one level fi reduction 2 essentially performs partial evaluation on terms. The usefulness of controlled fij rewriting for partial evaluation has been described in [21, 22] but was already used along the same lines in [20] to obtain a one pass CPS transformer. An interesting implication, which we will pursue in Section 3.3, is that when interpreting one level as syntax and the other as syntax construction we can, when using functional languages that adequately support the present notion of two levels (e.g. Scheme) ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....is false. Once terms are marked, the Boolean parameter to the timed reduce function is redundant because the step count for values does not depend on the Boolean parameter. The tail combinations identified by the above grammar play distinguished roles in other works. For example, Figure 3 in [5] presents a CPS transform that treats tail combinations specially. Contexts provide an alternative to a grammar for identifying tail combinations. A combination context is a # term when its hole is replaced by a combination. The set of combination contexts is defined by X # [ # X ( ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4), 1992. To appear.
....of ow information is that the CPS transformed program contains program points that have no counterparts in the source program. Our main observation is that this task becomes manageable when we use a variant of Plotkin s call by value CPS transformation that was introduced by Danvy and Filinski [4]. Here is part of the de nition of their CPS transformation: Our scheme for labeling expressions is di erent from the one used by Danvy and Filinski. We label all occurrences of expressions in the source and target programs; the ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361-391, 1992.
....programs: direct style (DS) # terms with literals. The BNF of DS programs is displayed in Figure 1. Assuming a call by value evaluation strategy, the BNF of CPS programs is displayed in Figure 2. CPS programs are prototypically obtained by CPS transforming DS programs, as defined in Figure 3 [7, 20, 21]. Figure 4 displays our starting point: a standard abstract machine implementing # reduction for CPS programs. This machine is a simplified version of another machine studied jointly with Belmina Dzafic and Frank Pfenning [6, 9, 11] We use two judgments, indexed by the syntactic categories of ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
.... Similix partial evaluator to handle call unfolding in the presence of dynamic actual parameters [10] Let insertion is a cornerstone of call by value type directed partial evaluation [18] Two level j expansion: The idea has been used both in the CPS transformation and in partial evaluation [19, 20]. Partial evaluation: With two exceptions, all other partial evaluators operate over the text of their source programs [14, 28] The first exception is Berlin s [6, 7] As described above, it operates by running the source program with instrumented primitive operators. The second exception is ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....CPS transformations. The traditional way amounts to (1) performing the translation following Plotkin s seminal specification [25] and (2) performing so called administrative reductions to simplify the resulting term. A more direct way, however, exists that combines (1) and (2) in one pass [6]. This method is crucially higher order and two level. Two level because it combines static simplifications and dynamic code generation; and higher order because it is expressed in the calculus. The technique used to obtain this system resembles the technique we used in the flattening Example ....
....(m:km) 18) he 0 e 1 i k:he 0 i (m:he 1 i (n:mn(a:k a) 19) where we exploit the sorting to ensure that (17) is only applied to variables) The CPS1 system is obviously a two level derivor. It is possible to prove its well annotatedness and termination directly using a typing argument [6, 24]. Instead, let us integrate the administrative fi contractions in the transformation, making it truly one pass in a rewriting sense; this will mechanically lead us to Sabry and Felleisen s compacting CPS transformation [27] That this integration is well defined is clear from Proposition ....
[Article contains additional citation context not shown here]
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....program so as to improve binding times. They are usually achieved by maintaining an explicit representation of control, using continuations. Specializers incorporating these techniques are known as continuation based specializers [6, 42, 45] Essentially they mimic one pass CPS transformations [15]. We formalize this technique with the associativity of let expressions in Moggi s computational metalanguage. Encoding the term above in the metalanguage yields: in (x : unit 2) v 2 Static reduction of the fi redex yields: Reassociating the let expression yields: Unfolding the inner ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....In fact, Cn and C v ffi T only differ by administrative reductions [23, p. 149] i.e. reductions introduced by the transformations that implement continuation passing) Thus, for optimizing transformations Cn:opt and C v:opt that produce CPS terms without administrative reductions [8], the output of Cn:opt is identical to the output of C v:opt ffi T . The difference between call by name and call by value evaluation lies in how arguments are treated. To simulate call by name with call by value evaluation, one needs a mechanism for turning arbitrary arguments into values. This ....
.... in a two level language a la Nielson and Nielson [21] Operationally, the overlined s and s correspond to functional abstractions and The output of Cn:opt is fi vjv equivalent to the output of Cn (similarly for Cv:opt and Cv ) A proof of Indifference and Simulation for Cv:opt is given in [8]. This proof extends to C v:opt in a straightforward manner. 28 C v:opt h[ Delta]i : C v:opt h[v]i = k:k C v:opt hvi C v:opt h[e 0 e 1 ]i = k:C v:opt h[e 0 ]i (y 0 :C v:opt h[e 1 ]i (y 1 :y 0 y 1 (y 2 :k y 2 ) C v:opt h Deltai : Values v [ C v:opt hbi = b C v:opt hxi = ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
.... corresponding reduction steps in direct style thus required Plotkin to develop a so called colon translation [17] which has stuck [12, 19] In the late 80 s, however, a new CPS transformation was developed that operates in one pass and performs administrative reductions at transformation time [1, 6, 23]. This one pass transformation is higher order (or more precisely: second order) and it is not clear how to prove properties about it, which is our goal here. This work. We restate the one pass CPS transformation in relational form and we present a proof technique using logical relations to ....
.... Sabry and Felleisen have documented such an approach [2, 19, 20, 21] Furthermore, it turns out that CPS transformation and administrative reductions can be integrated into one, higher order, rewriting system that directly produces a CPS program without administrative redexes, in one pass [1, 6, 8, 23]: Let us revisit the simple example above, using Figure 2. k:k x: k:x x k We consider this higher order CPS transformation here, as displayed in Figure 2, where it is phrased to match the syntactic domains of Sections 2.1 and 2.2. The one pass CPS transformation requires ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361-391, December 1992.
....the next instruction and generate explicit jumps to this label. The resulting translation, however, is not optimal because sequenced atomic commands yield redundant jumps to the next instruction. The problem is reminiscent of administrative redexes introduced by a Plotkin style CPS transformation [5, 11]. One could then duplicate the translation judgment. A first judgment would hold when the translated command ends with an explicit jump to the label of its next command, and a second would hold when the translated command flows into the next instruction. Duplication, however, is a slippery road ....
....We have pointed out how to avoid generating these chains of jumps. In SSA terms [3, 10, 15] our translation naturally yields fewer merge points without duplicating contexts. It also generates fewer basic blocks and thus makes it faster to compute an SSA form. Turning to the CPS transformation [5, 13], we observe that the issue of chains of jumps arises there in the form of spurious # redexes such as #v.k v, where k 14 denotes a continuation. These # redexes appear in the translation of tail calls and for nested conditional expressions, just like here for while loops and nested conditional ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
....pure calculus. Following Reynolds [18] we distinguish between trivial terms, whose reduction always terminate, and serious terms, whose reduction may diverge. Figures 2 and 3 display Plotkin s CPS transformation and the syntactic characterization of its output, after administrative reductions [5, 17, 19, 20]. Both BNF s were used in earlier work on the direct style transformation, the inverse of the CPS transformation [3, 8] 3 Idempotence: No Let us CPS transform the identity function x:x in an empty context, for simplicity. The result reads as follows. x:k 1 :k 1 x CPS transforming this result ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....style (CPS) calculus introduced just below. r 2 DRoot DS terms r : e e 2 DExp DS expressions e : e 0 e 1 j t t 2 DTriv DS trivial expressions t : x j x:r x 2 Ide identifiers Direct style terms are transformed into continuation passing style by CPS transformation [1, 7, 16, 17, 24, 25]. We consider left to right call by value, and Plotkin style CPS, i.e. with continuations last. Fischerstyle CPS follows mutatis mutandis, and other evaluation orders are addressed in Section 6. The BNF of CPS terms reads as follows. NB: We distinguish between the original identifiers x coming ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....program. This means that we must compute flow information for program points that have no counterpart in the source program. Our main observation is that this task becomes manageable when we use the variant of Plotkin s call by value CPS transformation that was introduced by Danvy and Filinski [1]. Here is part of the definition of their CPS transformation: x l ] P l k:k K l A l x l [ l x:e] P l k:k K l A l ( l x: Q l m: e] B L(e) R L(e) v:m M l C l v V L(e) e 1 l e 2 ] P l k: e 1 ] B L(e 1 ) R L(e 1 ) v 1 : e ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
....(g ( k : k c) k) a : a) A tedious but straightforward rewriting shows that the call by value evaluation of the term above yields c the result of the original expression when evaluated under call by name. Even after optimizing the above expression by performing administrative reductions [7, 20, 27], the reduction is still more involved than for the thunked term. Performing the reductions by hand gives an appreciation for the simplicity of thunks as a simulation and re enforces the motivation for systematically exploring their simulation properties. 1.3 Summary of contributions and ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....program. This means that we must compute flow information for program points that have no counterpart in the source program. Our main observation is that this task becomes manageable when we use the variant of Plotkin s call by value CPS transformation that was introduced by Danvy and Filinski [1], see Figure 1. We label all occurrences of expressions in the source and target programs. The labels in the CPS transformed program are chosen such that the label of a abstraction in the source program also is the label of the corresponding abstraction in the CPS transformed program. Many of ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
....of removing raisehandle expressions. Indeed, every expression becomes a higher order function application that receives two functions (continuations) At this stage, two orthogonal optimizations can take place: ffl We can perform administrative reductions, e.g. during the CPS transformation [DF92] ffl We can selectively apply the CPS transformation by exploiting the results of Yi and Ryu s exception analysis [YR97] The point is that an exception analysis tells us a conservative approximation of which expressions may raise an uncaught exception when they are evaluated and of which ....
....6.1 Sharing transducers We tested our transformation for the subst function of Figure 2, i.e. a sharing transducer implementing substitution with exceptions. Figure 10 displays the transformed program, which results from our one pass selective CPS transformer ( a la Danvy and Filinski [DF92] Figure 11 shows (in solid line) that the transformed program can run with almost twice the speed of the original exception based substitution program. As Graph (b) shows, if the program does not raise exceptions (hence handlers are not used) then the transformed program and the exceptionbased ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....3.3. 2 The CPS transformation Let us now turn to the transformation of terms into continuation passing style (CPS) This example is significant because historically, the virtue of eta redexes became apparent in connection with partial evaluation of CPS interpreters and with CPS transformers [2, 11]. Figure 5 displays Plotkin s original CPS transformation for the call by value lambda calculus [23] written as a two level term. Since the transformation is a syntax constructor, all occurrences of and are dynamic. As a matter of fact, Gomard s binding time analysis does classify all ....
....and v2 :k v2 enable k to be kept static. The types of the transformations (shown in the figures) summarize the binding time improvement. 2 In fact, in the particular case of the call by value CPS transformation, these static beta redexes precisely coincide with Plotkin s administrative redexes [11]. However, this coincidence only happens for call by value and not, e.g. for the call by name CPS transformation an observation independently made in fall 1993 by John Hatcliff at Kansas State University and by Ray McDowell at the University of Pennsylvania (personal communication to the ....
[Article contains additional citation context not shown here]
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....style (CPS) is a sublanguage of the calculus that is insensitive to evaluation order [20] It is interesting to compiler writers because transforming a program into CPS makes it sequential in a way that facilitates code generation. Here we merely formalize one published CPS transformation [4] (details in the full version of this article [6] 4.2.1. Definition (Call by Value CPS transformation) The eager, or Call by Value, CPS transformation can be expressed as a derivor over the two sorted syntax v : x (10) e : v j x:e j e 0 e 1 j x:e j e 0 e 1 j CPS1 (e) j hei (11) the ....
....(m:km) 14) he 0 e 1 i k:he 0 i (m:he 1 i (n:mn(a:k a) 15) where we exploit the sorting to ensure that (13) is only applied to variables) The CPS1 system is obviously a two level derivor. It is possible to prove its well annotatedness and termination directly using a typing argument [4, 19]. Instead, let us integrate the administrative fi contractions in the transformation, making it truly one pass in a rewriting sense; this will mechanically lead us to Sabry and Felleisen s compacting CPS transformation [22] That this integration is well defined is clear from Proposition ....
[Article contains additional citation context not shown here]
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
.... the corresponding reduction steps in direct style thus required Plotkin to develop a so called colon translation [17] which has stuck [12,19] In the late 80 s, however, a new CPS transformation was developed that operates in one pass and performs administrative reductions at transformation time [1,6,23]. This one pass transformation is higher order (or more precisely: second order) and it is not clear how to prove properties about it, which is our goal here. This work. We restate the one pass CPS transformation in relational form and we present a proof technique using logical relations to ....
.... fflffl Sabry and Felleisen have documented such an approach [2,19 21] Furthermore, it turns out that CPS transformation and administrative reductions can be integrated into one, higher order, rewriting system that directly produces a CPS program without administrative redexes, in one pass [1,6,8,23]: DS AGF actual reductions ED Fnan Fnan fflffl CPS transformation administrative reductions Fnan Fnan CPS BCED actual reductions GF Fnan Fnan fflffl Let us revisit the simple example above, using Figure 2. x:x x] DRoot = k:k x:k:x x k We consider this higher order CPS ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
.... the corresponding reduction steps in direct style thus required Plotkin to develop a so called colon translation [16] which has stuck [11,18] In the late 80 s, however, a new CPS transformation was developed that operates in one pass and performs administrative reductions at transformation time [1,5,22]. This one pass transformation is higher order (or more precisely: third order) and it is not clear how to prove properties about it, which is our goal here. This work. We restate the one pass CPS transformation in logical form and we present a proof technique using logical relations to prove a ....
.... ## ## Sabry and Felleisen have documented such an approach [2,18 20] Furthermore, it turns out that CPS transformation and administrative reductions can be integrated into one, higher order, rewriting system that directly produces a CPS program without administrative redexes, in one pass [1,5,7,22]: DS #### actual reductions ## ## CPS transformation administrative reductions ## CPS #### actual reductions ## ## We consider this higher order CPS transformation here, as displayed in Figure 2, where it is phrased to match the syntactic domains of Sections 2.1 and 2.2. The one pass ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361-391, December 1992.
....t : x j x:r x 2 Ide identifiers Figure 1 presents a one pass continuation passing style (CPS) transformer for the pure calculus with call by value evaluation from left to right. This transformer is an optimized version of Plotkin s CPS transformer [21] It was derived in an earlier work [8] and is only rephrased slightly here to match the syntactic domains. The result of transforming a DS term r into CPS is given by C[ r] These equations can be read as a two level specification a la Nielson and Nielson [19] and thus they can be transliterated in any functional programming ....
....to introducing control operators such as call cc to declare a first class continuation and throw to send a value to a first class continuation. More generally, relaxing the CPS texture to allow non tail calls would amount to introducing control operators and delimiters such as shift and reset [8, 10, 11, 15]. Other stagings of the CPS transformation are possible. For example, it is possible to (1) name intermediate values, 2) introduce named continuations, and (3) inline these continuations, obtaining a CPS term. In fact, it is even possible to factor out sequentialization from the CPS ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
....= pair(# t 1 fst v; # t 2 snd v) One can infer from Solution 3 that # b 1 b 2 v = x1:v x1 (where x1 is fresh) and more generally that # b t v = x:# t (v x) At higher types, the fresh variable needs to be coerced from dynamic to static. A bit of practice with two level etaexpansion [16, 17, 18] makes it clear that, for example: # (b 3 b 4 ) b 2 v = x1:v (x3:x1 x3) It is therefore natural to define a function that is symmetric to #, i.e. that coerces its argument from dynamic to static, and to define the residualization of functions as follows. # t 1 t 2 v = x1 :# t 2 ....
....residual case expression. Unless the source term is tail recursive, we thus need to abstract and to relocate this context. Context abstraction is achieved with a control operator. This context, however, needs to be delimited, which rules out call cc [10] but invites one to use shift and reset [16, 17] (though of course any other delimited control operator could do as well [21] 5 The extended residualizer is displayed in Figure 8. The following Scheme session illustrates this extension. residualize (lambda (x) x) A B) A B) lambda (x0) case record x0 [ Left x1) make Left ....
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
No context found.
Danvy, Olivier and Filinski, Andrzej. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2, 4 (December 1992) 361--391.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.
No context found.
Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, December 1992.
First 50 documents Next 50
Online articles have much greater impact More about CiteSeer.IST Add search form to your site Submit documents Feedback
CiteSeer.IST - Copyright Penn State and NEC