Results 1 - 10
of
24
Tutorial Notes on Partial Evaluation
- Proceedings of the Twentieth Annual ACM Symposium on Principles of Programming Languages
, 1993
"... The last years have witnessed a flurry of new results in the area of partial evaluation. These tutorial notes survey the field and present a critical assessment of the state of the art. 1 Introduction Partial evaluation is a source-to-source program transformation technique for specializing program ..."
Abstract
-
Cited by 230 (60 self)
- Add to MetaCart
The last years have witnessed a flurry of new results in the area of partial evaluation. These tutorial notes survey the field and present a critical assessment of the state of the art. 1 Introduction Partial evaluation is a source-to-source program transformation technique for specializing programs with respect to parts of their input. In essence, partial evaluation removes layers of interpretation. In the most general sense, an interpreter can be defined as a program whose control flow is determined by its input data. As Abelson points out, [43, Foreword], even programs that are not themselves interpreters have important interpreter-like pieces. These pieces contain both compile-time and run-time constructs. Partial evaluation identifies and eliminates the compile-time constructs. 1.1 A complete example We consider a function producing formatted text. Such functions exist in most programming languages (e.g., format in Lisp and printf in C). Figure 1 displays a formatting functio...
Total Correctness by Local Improvement in the Transformation of Functional Programs
- ACM Transactions on Programming Languages and Systems
, 1996
"... ion. A common form of transformation, which is easily justified by appealing to reversibility, is abstraction. The abstraction transformation lifts some instances of subexpressions from the right-hand sides of a set of definitions and replaces them with function calls for some new functions. The ab ..."
Abstract
-
Cited by 55 (6 self)
- Add to MetaCart
ion. A common form of transformation, which is easily justified by appealing to reversibility, is abstraction. The abstraction transformation lifts some instances of subexpressions from the right-hand sides of a set of definitions and replaces them with function calls for some new functions. The abstraction process can be used in conjunction with a call-by-need implementation to avoid repeated evaluation of subexpressions. A well-known example is Hughes' supercombinator abstraction [Hughes 1982]. Another form of abstraction which is common in program transformation is syntactic generalization in which an expression e is replaced by a function call g e 1 : : : e n , where g is a new function defined by g x 1 : : : xn \Delta = e 0 , such that e j e 0 f e 1 : : : e n= x 1 : : : xn g. General statements about abstractions and their correctness are notationally rather complex. In practice we have found it is easier to appeal to a reversibility argument on a case-by-case basis than...
Proving the Correctness of Recursion-Based Automatic Program Transformations
- Theoretical Computer Science
, 1996
"... This paper shows how the Improvement Theorem---a semantic condition ..."
Abstract
-
Cited by 27 (4 self)
- Add to MetaCart
This paper shows how the Improvement Theorem---a semantic condition
Generating Transformers for Deforestation and Supercompilation
- Static Analysis, volume 864 of Lecture Notes in Computer Science
, 1994
"... . Our aim is to study how the interpretive approach --- inserting an interpreter between a source program and a program specializer --- can be used to improve the transformation of programs and to automatically generate program transformers by self-application of a program specializer. We show ..."
Abstract
-
Cited by 25 (7 self)
- Add to MetaCart
. Our aim is to study how the interpretive approach --- inserting an interpreter between a source program and a program specializer --- can be used to improve the transformation of programs and to automatically generate program transformers by self-application of a program specializer. We show that a few semantics-preserving transformations applied to a straightforward interpretive definition of a first-order, call-by-name language are sufficient to generate Wadler's deforestation algorithm and a version of Turchin's supercompiler using a partial evaluator. The transformation is guided by the need to binding-time improve the interpreters. 1 Introduction Our aim is to study the interpretive approach to improve the transformation of source programs and to automatically generate stand-alone transformers [Tur93, GJ94]. The essence of the interpretive approach is to insert an interpreter between a source program and a generic program specializer. As defined by the specializer pro...
Partial Evaluation for Higher-Order Languages with State
, 1996
"... We have designed and implemented an offline partial evaluator for a higher-order language with first-class references. Its distinguishing feature over other partial evaluators is its ability to perform assignments to local and global references at specialization time for a higher-order language. The ..."
Abstract
-
Cited by 23 (7 self)
- Add to MetaCart
We have designed and implemented an offline partial evaluator for a higher-order language with first-class references. Its distinguishing feature over other partial evaluators is its ability to perform assignments to local and global references at specialization time for a higher-order language. The partial evaluator consists of a region-based monovariant binding-time analysis and a specializer in essentially continuation-passing store-passing style, thus generalizing type-based binding-time analysis and continuation-based partial evaluation. The partial evaluator yields good results for realistic problems such as object-oriented programming, unification, and specializer generation. Keywords: higher-order programming, program transformation, partial evaluation, state Categories: D.1.1 Applicative (Functional) Programming, D.1.2 Automatic Programming, D.3.1 Formal Definitions and Theory, Semantics, D.3.2 Language Classifications, Applicative languages, D.3.4 Processors, I.2.2 Automatic...
Eta-Expansion does the Trick
- ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS
, 1996
"... Partial-evaluation folklore has it that massaging one's source programs can make them specialize better. In Jones, Gomard, and Sestoft's recent textbook, a whole chapter is dedicated to listing such "binding-time improvements": nonstandard use of continuationpassing style, eta-expansion, and a popul ..."
Abstract
-
Cited by 22 (6 self)
- Add to MetaCart
Partial-evaluation folklore has it that massaging one's source programs can make them specialize better. In Jones, Gomard, and Sestoft's recent textbook, a whole chapter is dedicated to listing such "binding-time improvements": nonstandard use of continuationpassing style, eta-expansion, and a popular transformation called "The Trick". We provide a unified view of these binding-time improvements, from a typing perspective. Just as a
Total Correctness by Local Improvement in Program Transformation
- In Proceedings of the 22nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL
, 1995
"... The goal of program transformation is to improve efficiency while preserving meaning. One of the best known transformation techniques is Burstall and Darlington's unfold-fold method. Unfortunately the unfold-fold method itself guarantees neither improvement in efficiency nor total-correctness. The c ..."
Abstract
-
Cited by 20 (3 self)
- Add to MetaCart
The goal of program transformation is to improve efficiency while preserving meaning. One of the best known transformation techniques is Burstall and Darlington's unfold-fold method. Unfortunately the unfold-fold method itself guarantees neither improvement in efficiency nor total-correctness. The correctness problem for unfold-fold is an instance of a strictly more general problem: transformation by locally equivalence-preserving steps does not necessarily preserve (global) equivalence. This paper presents a condition for the total correctness of transformations on recursive programs, which, for the first time, deals with higher-order functional languages (both strict and non-strict) including lazy data structures. The main technical result is an improvement theorem which says that if the local transformation steps are guided by certain optimisation concerns (a fairly natural condition for a transformation), then correctness of the transformation follows. The improvement theorem make...
A Categorical Account of Two-Level Languages
- In MFPS
, 1997
"... We give an account of two-level languages in terms of indexed categories and universal properties well-known in the context of categorical logic. This account provides three important insights: establishes precise analogies between two-level languages and module languages, explains the two-level lan ..."
Abstract
-
Cited by 18 (4 self)
- Add to MetaCart
We give an account of two-level languages in terms of indexed categories and universal properties well-known in the context of categorical logic. This account provides three important insights: establishes precise analogies between two-level languages and module languages, explains the two-level languages used in partial evaluation (see [7]) in terms of those used for code generation (see [16]), suggests extensions that should be valuable for type-specialization (see [9]) and shape-analysis (see [1]).
Functor Categories and Two-Level Languages
- In Foundations of Software Science and Computation Structures (FoSSaCS
, 1998
"... We propose a denotational semantics for the two-level language of [GJ91, Gom92], and prove its correctness w.r.t. a standard denotational semantics. Other researchers (see [Gom91, GJ91, Gom92, JGS93, HM94]) have claimed correctness for lambda-mix (or extensions of it) based on denotational models, b ..."
Abstract
-
Cited by 15 (4 self)
- Add to MetaCart
We propose a denotational semantics for the two-level language of [GJ91, Gom92], and prove its correctness w.r.t. a standard denotational semantics. Other researchers (see [Gom91, GJ91, Gom92, JGS93, HM94]) have claimed correctness for lambda-mix (or extensions of it) based on denotational models, but the proofs of such claims rely on imprecise definitions and are basically awed. At a technical level there are two important differences between our model and more naive models in Cpo: the domain for interpreting dynamic expressions is more abstract (we interpret code as -terms modulo -conversion), the semantics of newname is handled differently (we exploit functor categories). The key idea is to interpret a two-level language in a suitable functor category Cpo D op rather than Cpo. The semantics of newname follows the ideas pioneered by Oles and Reynolds for modeling the stack discipline of Algol-like languages. Indeed, we can think of the objects of D (i.e. the natural numbers) as ...
Generating Action Compilers by Partial Evaluation
- Journal of Functional Programming
, 1996
"... Compiler generation based on Mosses' action semantics has been studied by Brown, Moura, and Watt, and also by the second author. The core of each of their systems is a handwritten action compiler, producing either C or machine code. We have obtained an action compiler in a much simpler way: by parti ..."
Abstract
-
Cited by 12 (1 self)
- Add to MetaCart
Compiler generation based on Mosses' action semantics has been studied by Brown, Moura, and Watt, and also by the second author. The core of each of their systems is a handwritten action compiler, producing either C or machine code. We have obtained an action compiler in a much simpler way: by partial evaluation of an action interpreter. Even though our compiler produces Scheme code, the code runs as fast as that produced by the previous action compilers. 1 Introduction Action semantics is a framework for formal semantics of programming languages, developed by Mosses [16, 17, 18] and Watt [19, 26]. It differs from denotational semantics in using semantic entities called actions, rather than higher-order functions. Compiler generation based on action semantics has been studied by Brown, Moura, and Watt [6], and also by the second author [22, 20, 21]. Journal of Functional Programming, 6(2):269--298, 1996. Also in Proc. FPCA'93, pages 308--317. The core of each of their two action se...

