Results 11 - 20
of
61
Warm Fusion in Stratego: A Case Study in Generation of Program Transformation Systems
, 2000
"... Stratego is a domain-specic language for the specication of program transformation systems. The design of Stratego is based on the paradigm of rewriting strategies: user-denable programs in a little language of strategy operators determine where and in what order transformation rules are (automat ..."
Abstract
-
Cited by 22 (13 self)
- Add to MetaCart
Stratego is a domain-specic language for the specication of program transformation systems. The design of Stratego is based on the paradigm of rewriting strategies: user-denable programs in a little language of strategy operators determine where and in what order transformation rules are (automatically) applied to a program. The separation of rules and strategies supports modularity of specications. Stratego also provides generic features for specication of program traversals. In this paper we present a case study of Stratego as applied to a non-trivial problem in program transformation. We demonstrate the use of Stratego in eliminating intermediate data structures from (also known as deforesting) functional programs via the warm fusion algorithm of Launchbury and Sheard. This algorithm has been specied in Stratego and embedded in a fully automatic transformation system for kernel Haskell. The entire system consists of about 2600 lines of specication code, which bre...
Erratic Fudgets: A Semantic Theory for an Embedded Coordination Language
- SCIENCE OF COMPUTER PROGRAMMING
, 2003
"... The powerful abstraction mechanisms of functional programming languages provide the means to develop domain-specific programming languages within the language itself. Typically, this is realised by designing a set of combinators (higher-order reusable programs) for an application area, and by constr ..."
Abstract
-
Cited by 20 (3 self)
- Add to MetaCart
The powerful abstraction mechanisms of functional programming languages provide the means to develop domain-specific programming languages within the language itself. Typically, this is realised by designing a set of combinators (higher-order reusable programs) for an application area, and by constructing individual applications by combining and coordinating individual combinators. This paper is concerned with a successful example of such an embedded programming language, namely Fudgets, a library of combinators for building graphical user interfaces in the lazy functional language Haskell. The Fudget library has been used to build a number of substantial applications, including a web browser and a proof editor interface to a proof checker for constructive type theory. This paper develops a semantic theory for the non-deterministic stream processors that are at the heart of the Fudget concept. The interaction of two features of stream processors makes the development of such a semantic theory problematic: (i) the sharing of computation provided by the lazy evaluation mechanism of the underlying host language, and (ii) the addition of non-deterministic choice needed to handle the natural concurrency that reactive applications entail We demonstrate that this combination of features in a higher-order functional language can be tamed to provide a tractable semantic theory and induction principles suitable for reasoning about contextual equivalence of Fudgets.
Constraint Systems for Useless Variable Elimination
, 1998
"... A useless variable is one whose value contributes nothing to the final outcome of a computation. Such variables are unlikely to occur in human-produced code, but may be introduced by various program transformations. We would like to eliminate useless parameters from procedures and eliminate the corr ..."
Abstract
-
Cited by 19 (1 self)
- Add to MetaCart
A useless variable is one whose value contributes nothing to the final outcome of a computation. Such variables are unlikely to occur in human-produced code, but may be introduced by various program transformations. We would like to eliminate useless parameters from procedures and eliminate the corresponding actual parameters from their call sites. This transformation is the extension to higher-order programming of a variety of dead-code elimination optimizations that are important in compilers for first-order imperative languages. Shivers has presented such a transformation. We reformulate the transformation and prove its correctness. We believe that this correctness proof can be a model for proofs of other analysis-based transformations. We proceed as follows: ffl We reformulate Shivers' analysis as a set of constraints; since the constraints are conditional inclusions, they can be solved using standard algorithms. ffl We prove that any solution to the constraints is sound: that tw...
Type-Based Useless Variable Elimination
, 1999
"... We show a type-based method for useless variable elimination, i.e., transformation that eliminates variables whose values contribute nothing to the final outcome of a computation, and prove its correctness. The algorithm is a surprisingly simple extension of the usual type reconstruction algorithm. ..."
Abstract
-
Cited by 18 (4 self)
- Add to MetaCart
We show a type-based method for useless variable elimination, i.e., transformation that eliminates variables whose values contribute nothing to the final outcome of a computation, and prove its correctness. The algorithm is a surprisingly simple extension of the usual type reconstruction algorithm. Our method seems more attractive than Wand and Siveroni's 0CFA-based method in many respects. First, it is efficient: it runs in time almost linear in the size of an input expression for a simply-typed -calculus, while the 0CFA-based method may require a cubic time. Second, our transformation can be shown to be optimal among those that preserve well-typedness, both for the simply-typed language and for an ML-style polymorphically-typed language. On the other hand, the 0CFA-based method is not optimal for the polymophically-typed language. ANY OTHER IDENTIFYING INFORMATION OF THIS REPORT Summary has been submitted for publication. Up-to-date version of this report will be available through ...
Higher-order Matching for Program Transformation
, 1999
"... We present a simple, practical algorithm for higher order matching in the context of automatic program transformation. Our algorithm finds more matches than the standard second order matching algorithm of Huet and Lang, but it has an equally simple specification, and it is better suited to the tr ..."
Abstract
-
Cited by 14 (1 self)
- Add to MetaCart
We present a simple, practical algorithm for higher order matching in the context of automatic program transformation. Our algorithm finds more matches than the standard second order matching algorithm of Huet and Lang, but it has an equally simple specification, and it is better suited to the transformation of programs in modern programming languages such as Haskell or ML. The algorithm has been implemented as part of the MAG system for transforming functional programs. 1 Background and motivation 1.1 Program transformation Many program transformations are conveniently expressed as higher order rewrite rules. For example, consider the well-known transformation that turns a tail recursive function into an imperative loop. The pattern f x = if p x then g x else f (h x ) is rewritten to the term f x = j[ var r ; r := x ; while :(p r) do r := h r ; r := g r ; return r ]j Carefully consider the pattern in this rule: it involves two bound variables, namely f and x , and ...
Fine Control of Demand in Haskell
- In 6th International Conference on the Mathematics of Program Construction, Dagstuhl
, 2002
"... Functional languages have the A-calculus at their core, but then depart fi'om this fu'm foundation by including features that alter their default evaluation order. The resulting mixed evaluation--partly lazy and partly strict--complicates the formal semantics of these languages. ..."
Abstract
-
Cited by 12 (5 self)
- Add to MetaCart
Functional languages have the A-calculus at their core, but then depart fi'om this fu'm foundation by including features that alter their default evaluation order. The resulting mixed evaluation--partly lazy and partly strict--complicates the formal semantics of these languages.
Constructor specialisation for Haskell programs
, 2007
"... User-defined data types, pattern-matching, and recursion are ubiquitous features of Haskell programs. Sometimes a function is called with arguments that are statically known to already be in constructor form, so that the work of pattern-matching is wasted. Even worse, the argument is sometimes fres ..."
Abstract
-
Cited by 11 (3 self)
- Add to MetaCart
User-defined data types, pattern-matching, and recursion are ubiquitous features of Haskell programs. Sometimes a function is called with arguments that are statically known to already be in constructor form, so that the work of pattern-matching is wasted. Even worse, the argument is sometimes freshly-allocated, only to be immediately decomposed by the function. In this paper we describe a simple, modular transformation that specialises recursive functions according to their argument “shapes”. We show that such a transformation has a simple, modular implementation, and that it can be extremely effective in practice, eliminating both pattern-matching and heap allocation. We describe our implementation of this constructor specialisation transformation in the Glasgow Haskell Compiler, and give measurements of its effectiveness.
Fusing Logic and Control with Local Transformations: An Example Optimization
- Workshop on Reduction Strategies in Rewriting and Programming (WRS’01), volume 57 of Electronic Notes in Theoretical Computer Science
, 2001
"... Abstract programming supports the separation of logical concerns from issues of control in program construction. While this separation of concerns leads to reduced code size and increased reusability of code, its main disadvantage is the computational overhead it incurs. Fusion techniques can be use ..."
Abstract
-
Cited by 10 (7 self)
- Add to MetaCart
Abstract programming supports the separation of logical concerns from issues of control in program construction. While this separation of concerns leads to reduced code size and increased reusability of code, its main disadvantage is the computational overhead it incurs. Fusion techniques can be used to combine the reusability of abstract programs with the e#ciency of specialized programs.
Simple Usage Polymorphism
- TIC 2000
, 2000
"... We present a novel inference algorithm for a type system featuring subtyping and usage (annotation) polymorphism. This algorithm infers simply-polymorphic types rather than the constrained-polymorphic types usual in such a setting; it achieves this by means of constraint approximation. The algorithm ..."
Abstract
-
Cited by 10 (0 self)
- Add to MetaCart
We present a novel inference algorithm for a type system featuring subtyping and usage (annotation) polymorphism. This algorithm infers simply-polymorphic types rather than the constrained-polymorphic types usual in such a setting; it achieves this by means of constraint approximation. The algorithm is motivated by practical considerations and experience of a previous system, and has been implemented in a production compiler with positive results. We believe the algorithm may well have applications in settings other than usage-type inference.

