## Pragmatic Aspects of Type-Directed Partial Evaluation (1996)

Citations: | 5 - 0 self |

### BibTeX

@MISC{Danvy96pragmaticaspects,

author = {Olivier Danvy},

title = {Pragmatic Aspects of Type-Directed Partial Evaluation},

year = {1996}

}

### OpenURL

### Abstract

Type-directed partial evaluation stems from the residualization of static values in dynamic contexts, given their type and the type of their free variables. Its algorithm coincides with the algorithm for coercing a subtype value into a supertype value, which itself coincides with Berger and Schwichtenberg's normalization algorithm for the simply typed -calculus. Type-directed partial evaluation thus can be used to specialize a compiled, closed program, given its type.

### Citations

663 |
Partial evaluation and automatic program generation
- Jones, Gomard, et al.
- 1993
(Show Context)
Citation Context ... Munkegade, Building 540, DK-8000 Aarhus C, Denmark. Phone: (+45) 89 42 33 69. Fax: (+45) 89 42 32 55. Home page: http://www.brics.dk/~danvy. 1s1 Introduction 1.1 Background During partial evaluation =-=[11, 27]-=-, parts of a program are evaluated and parts are reconstructed. The parts that are reconstructed yield residual expressions forming the residual program. The parts that are evaluated yield static valu... |

281 | The essence of compiling with continuations
- Flanagan, Sabry, et al.
- 1993
(Show Context)
Citation Context ...0 a1)]) (x2 b3 b3))) > A residual let expression has been inserted. This let insertion naturally scales up, yielding residual programs in “CPS without continuations” (a.k.a. “nqCPS”, “A-normal forms” =-=[22]-=-, “monadic normal forms” [24], etc.), as illustrated below. > (residualize (lambda (f x k) ((lambda (v) (k v v)) (f (f x)))) ’(((b -!> b) b ((b b) => c)) => c)) 4s(lambda (x0 b1 x2) (let* ([b3 (x0 b1)... |

239 | Tutorial notes on partial evaluation
- Consel, Danvy
- 1993
(Show Context)
Citation Context ... Munkegade, Building 540, DK-8000 Aarhus C, Denmark. Phone: (+45) 89 42 33 69. Fax: (+45) 89 42 32 55. Home page: http://www.brics.dk/~danvy. 1s1 Introduction 1.1 Background During partial evaluation =-=[11, 27]-=-, parts of a program are evaluated and parts are reconstructed. The parts that are reconstructed yield residual expressions forming the residual program. The parts that are evaluated yield static valu... |

210 | Type-directed partial evaluation
- Danvy
- 1996
(Show Context)
Citation Context ... users to “improve the binding times” of their source programs [27, Chapter 12]. This residualization function operating at higher types forms the starting point of “type-directed partial evaluation” =-=[13]-=-. 1.2 Type-directed partial evaluation Type-directed partial evaluation stems from the desire to residualize arbitrary static values in dynamic contexts. Residualizing static values requires knowing t... |

176 | Logic programming in the LF logical framework
- Pfenning
- 1991
(Show Context)
Citation Context ...e improvements at higher type [17, 18], and coincides with the coercion algorithm in type systems with subtypes [25, 26], and with a normalization algorithm in proof theory [1] and logical frameworks =-=[35]-=-. This last coincidence suggests that it is possible to specialize compiled programs, by interpreting static expressions as executable code and dynamic expressions as code constructors. We have named ... |

153 |
The Theory and Practice of First-Class Prompts
- Felleisen
- 1988
(Show Context)
Citation Context ... this call. Point (3) requires us to relocate the context of the call in the body of the let expression. This relocation is achieved by abstracting delimited control, for example with shift and reset =-=[14, 15, 19]-=-. This approach is similar to the strategy for continuation-based partial evaluation [6, 29]. The complete specification of type-directed partial evaluation is shown in Figure 1, using the two-level λ... |

118 | Danvy “Automatic autoprojection of recursive equations with global variables and abstract data types
- Bondorf, O
- 1991
(Show Context)
Citation Context ...edy this situation. We extend the language of types handled by type-directed partial evaluation to account for impure procedures, whose application should not be duplicated. Our treatment is standard =-=[7]-=- — we insert a residual let expression. 1.4 Let insertion Let us residualize the value of foo again. This time, we specify that its first argument might perform a side effect (indicated by an annotate... |

107 | Danvy and Andrzej Filinski. Representing control: a study of the CPS transformation - Olivier - 1992 |

87 | A generic account of continuation-passing styles
- Hatcliff, Danvy
- 1994
(Show Context)
Citation Context ...dual let expression has been inserted. This let insertion naturally scales up, yielding residual programs in “CPS without continuations” (a.k.a. “nqCPS”, “A-normal forms” [22], “monadic normal forms” =-=[24]-=-, etc.), as illustrated below. > (residualize (lambda (f x k) ((lambda (v) (k v v)) (f (f x)))) ’(((b -!> b) b ((b b) => c)) => c)) 4s(lambda (x0 b1 x2) (let* ([b3 (x0 b1)] [b4 (x0 b3)]) (x2 b4 b4))) ... |

70 | A tour of Schism: A partial evaluation system for higher-order applicative languages
- Consel
- 1993
(Show Context)
Citation Context ...atching the fact that Figure 4 is the CPS counterpart of Figure 3 [16], Figure 6 is the textual CPS counterpart of Figure 5. This property usually holds modulo renaming, using e.g., Schism or Similix =-=[5, 9]-=-. The following diagram summarizes the situation. Rd denotes the residualizing function of Figure 1. C denotes the CPS transformation. Tiny d and Tiny c denote the text of the direct-style and of the ... |

69 |
Improving binding times without explicit cps-conversion
- Bondorf
- 1992
(Show Context)
Citation Context ...ession. This relocation is achieved by abstracting delimited control, for example with shift and reset [14, 15, 19]. This approach is similar to the strategy for continuation-based partial evaluation =-=[6, 29]-=-. The complete specification of type-directed partial evaluation is shown in Figure 1, using the two-level λ-calculus [33], and in Figure 2, using Scheme. Overlined λ’s and @’s denote ordinary λ-abstr... |

59 |
Abstract continuations: A mathematical semantics for handling full jumps
- Felleisen, Wand, et al.
- 1988
(Show Context)
Citation Context ...stracted continuation here does not “jump out” to yield a final answer. It returns a result at its point of application. This functional behavior makes it possible to compose abstracted continuations =-=[14, 20]-=-. 20s(define-record (Leaf x)) (define-record (Node left-tree right-tree)) (define flatten (lambda (t) ;;; Binary-Tree(X) -> List(X) (letrec ([help (lambda (t) (case-record t [(Leaf x) (Shift k (cons x... |

57 |
Danvy and Andrzej Filinski. Abstracting control
- Olivier
(Show Context)
Citation Context ... this call. Point (3) requires us to relocate the context of the call in the body of the let expression. This relocation is achieved by abstracting delimited control, for example with shift and reset =-=[14, 15, 19]-=-. This approach is similar to the strategy for continuation-based partial evaluation [6, 29]. The complete specification of type-directed partial evaluation is shown in Figure 1, using the two-level λ... |

54 |
An inverse of the evaluation functional for typed λ–calculus
- Berger, Schwichtenberg
- 1991
(Show Context)
Citation Context ... one for source binding-time improvements at higher type [17, 18], and coincides with the coercion algorithm in type systems with subtypes [25, 26], and with a normalization algorithm in proof theory =-=[1]-=- and logical frameworks [35]. This last coincidence suggests that it is possible to specialize compiled programs, by interpreting static expressions as executable code and dynamic expressions as code ... |

50 |
Self-Applicable Partial Evaluation
- Bondorf
- 1990
(Show Context)
Citation Context ...and also to treat dynamic sideeffects soundly [7]. Doubled with a variable-splitting mechanism [32], it provides a simple and elegant treatment of both partially static values and higher-order values =-=[4]-=-. In the next section, we adapt this let-insertion technique to type-directed partial evaluation. 4 The particular case of type-directed partial evaluation Lacking access to the source code, it is imp... |

50 | Controlling Effects
- Filinski
- 1996
(Show Context)
Citation Context ...disjoint sums supersedes the treatment for let insertion. This is thus a case for shift2 and reset2 [14]. We leave this aspect for future work. 7.4 An extensional CPS transformation In his PhD thesis =-=[21]-=-, Filinski defines extensional mappings between monadic values (and programs them in Standard ML). In particular, this makes it possible to define an extensional CPS transformation, in the particular ... |

48 | Static and dynamic semantics processing
- Consel, Danvy
- 1991
(Show Context)
Citation Context ... contains series of flat let expressions. These are characteristic of nqCPS. 5 An example: Paulson’s Tiny interpreter Paulson’s Tiny language [34] is a classical example in partial-evaluation circles =-=[4, 7, 10, 27, 32]-=-. Its BNF reads as follows (see Figure 8). 〈pgm〉 ::= block 〈decl〉 ∗ in 〈cmd〉 end 〈decl〉 ::= 〈ide〉 ∗ 11s〈cmd〉 ::= skip | 〈cmd〉 ; 〈cmd〉 | 〈ide〉 := 〈exp〉 | if 〈exp〉 then 〈cmd〉 else 〈cmd〉 | while 〈exp〉 do... |

45 |
Partially static structures in a self-applicable partial evaluator
- Mogensen
- 1988
(Show Context)
Citation Context ...structures, Torben Mogensen suggested to insert a residual let expression for each dynamic parameter, and to pass on the residual identifier naming the dynamic argument instead of the argument itself =-=[31]-=-. As illustrated in Section 1, under call-by-value, let-declared identifiers can be duplicated without compromising the dynamic semantics of source programs. This simple solution, put at the core of S... |

39 | Formally optimal boxing
- Henglein, Jørgensen
- 1994
(Show Context)
Citation Context ...tructure of their free variables. Its algorithm parallels the one for source binding-time improvements at higher type [17, 18], and coincides with the coercion algorithm in type systems with subtypes =-=[25, 26]-=-, and with a normalization algorithm in proof theory [1] and logical frameworks [35]. This last coincidence suggests that it is possible to specialize compiled programs, by interpreting static express... |

34 | The essence of eta-expansion in partial evaluation
- Danvy, Malmkjr, et al.
- 1995
(Show Context)
Citation Context ...values. If these values are higher-order, residualization also requires the type structure of their free variables. Its algorithm parallels the one for source binding-time improvements at higher type =-=[17, 18]-=-, and coincides with the coercion algorithm in type systems with subtypes [25, 26], and with a normalization algorithm in proof theory [1] and logical frameworks [35]. This last coincidence suggests t... |

33 | Partial Evaluation and Mixed Computation - Bjørner, Ershov, et al. - 1987 |

28 |
Automatic call unfolding in a partial evaluator
- Sestoft
- 1988
(Show Context)
Citation Context ...programs. This simple solution, put at the core of Similix, before it even had partially static values, has scaled up remarkably well, e.g., to solve the thorny 7sproblem of automating call unfolding =-=[37]-=-, and also to treat dynamic sideeffects soundly [7]. Doubled with a variable-splitting mechanism [32], it provides a simple and elegant treatment of both partially static values and higher-order value... |

22 | Eta-expansion does the trick
- Danvy, Malmkjr, et al.
- 1995
(Show Context)
Citation Context ...values. If these values are higher-order, residualization also requires the type structure of their free variables. Its algorithm parallels the one for source binding-time improvements at higher type =-=[17, 18]-=-, and coincides with the coercion algorithm in type systems with subtypes [25, 26], and with a normalization algorithm in proof theory [1] and logical frameworks [35]. This last coincidence suggests t... |

21 |
Binding Time Aspects of Partial Evaluation
- Mogensen
- 1989
(Show Context)
Citation Context ...s, has scaled up remarkably well, e.g., to solve the thorny 7sproblem of automating call unfolding [37], and also to treat dynamic sideeffects soundly [7]. Doubled with a variable-splitting mechanism =-=[32]-=-, it provides a simple and elegant treatment of both partially static values and higher-order values [4]. In the next section, we adapt this let-insertion technique to type-directed partial evaluation... |

17 |
Compiler Generation from Denotational Semantics
- Paulson
- 1984
(Show Context)
Citation Context ... Section 5, the result of type-directed partial evaluation contains series of flat let expressions. These are characteristic of nqCPS. 5 An example: Paulson’s Tiny interpreter Paulson’s Tiny language =-=[34]-=- is a classical example in partial-evaluation circles [4, 7, 10, 27, 32]. Its BNF reads as follows (see Figure 8). 〈pgm〉 ::= block 〈decl〉 ∗ in 〈cmd〉 end 〈decl〉 ::= 〈ide〉 ∗ 11s〈cmd〉 ::= skip | 〈cmd〉 ; ... |

15 | On the Transformation Between Direct and Continuation Semantics
- Danvy, Hatcliffe
- 1993
(Show Context)
Citation Context ... the store and of the continuation are declared with an alias, since both are single-threaded in the definitional interpreter. 16s4. Matching the fact that Figure 4 is the CPS counterpart of Figure 3 =-=[16]-=-, Figure 6 is the textual CPS counterpart of Figure 5. This property usually holds modulo renaming, using e.g., Schism or Similix [5, 9]. The following diagram summarizes the situation. Rd denotes the... |

13 |
The Structure of Continuation-Passing Styles
- Hatcliff
- 1994
(Show Context)
Citation Context ...Tiny d (Figure 3) [Tiny d] fac Figure 5 C Rd �� �� �� Tinyc (Figure 4) [Tinyc] fac �� Figure 6 6 Corollary: CPS transformation of compiled programs It is very simple to translate nqCPS terms into CPS =-=[12, 23, 28]-=-. Let expressions, for example, in the context of a continuation k, are essentially desugared as follows: Rd 〈[let v = f@x in e]〉 k = f@x@(λv.〈[e]〉 k) This makes it simple to adapt Figure 1 to produce... |

12 |
Dynamic typing: Syntax and proof theory. Science of Computer Programming
- Henglein
- 1993
(Show Context)
Citation Context ...tructure of their free variables. Its algorithm parallels the one for source binding-time improvements at higher type [17, 18], and coincides with the coercion algorithm in type systems with subtypes =-=[25, 26]-=-, and with a normalization algorithm in proof theory [1] and logical frameworks [35]. This last coincidence suggests that it is possible to specialize compiled programs, by interpreting static express... |

11 |
Similix manual, system version 3.0
- Bondorf
- 1991
(Show Context)
Citation Context ...atching the fact that Figure 4 is the CPS counterpart of Figure 3 [16], Figure 6 is the textual CPS counterpart of Figure 5. This property usually holds modulo renaming, using e.g., Schism or Similix =-=[5, 9]-=-. The following diagram summarizes the situation. Rd denotes the residualizing function of Figure 1. C denotes the CPS transformation. Tiny d and Tiny c denote the text of the direct-style and of the ... |

11 |
to direct style. Science of Computer Programming
- Back
- 1994
(Show Context)
Citation Context ...Tiny d (Figure 3) [Tiny d] fac Figure 5 C Rd �� �� �� Tinyc (Figure 4) [Tinyc] fac �� Figure 6 6 Corollary: CPS transformation of compiled programs It is very simple to translate nqCPS terms into CPS =-=[12, 23, 28]-=-. Let expressions, for example, in the context of a continuation k, are essentially desugared as follows: Rd 〈[let v = f@x in e]〉 k = f@x@(λv.〈[e]〉 k) This makes it simple to adapt Figure 1 to produce... |

10 | ML partial evaluation using set-based analysis
- Malmkj, Heintze, et al.
- 1994
(Show Context)
Citation Context ...m side effects. Therefore it it sufficient to name these residual calls and return the corresponding (fresh) identifiers to the current context. This follows the spirit of lightweight symbolic values =-=[30]-=-, where the only dynamic expressions in the data flow are residual identifiers. Thus we choose (1) to annotate the type of procedures that may perform side effects, (2) to insert a residual let expres... |

7 |
Detecting global variables in denotational definitions
- Schmidt
- 1985
(Show Context)
Citation Context ...variable of a declared type. This can happen either statically (the variable is declared at the outset of a residual program) or dynamically (all variables of this type denote a single-threaded value =-=[36]-=-). Both instances are illustrated in Section 5. 2.3 An example The type (b (c -> b) c) => b denotes an uncurried Scheme procedure with three arguments. We associate the name stub “Y” to the (base) typ... |

6 |
Continuation Introduction and Elimination in Higher-Order Programming Languages
- Lawall
- 1994
(Show Context)
Citation Context ...Tiny d (Figure 3) [Tiny d] fac Figure 5 C Rd �� �� �� Tinyc (Figure 4) [Tinyc] fac �� Figure 6 6 Corollary: CPS transformation of compiled programs It is very simple to translate nqCPS terms into CPS =-=[12, 23, 28]-=-. Let expressions, for example, in the context of a continuation k, are essentially desugared as follows: Rd 〈[let v = f@x in e]〉 k = f@x@(λv.〈[e]〉 k) This makes it simple to adapt Figure 1 to produce... |