Results 11  20
of
82
Warm Fusion in Stratego: A Case Study in Generation of Program Transformation Systems
, 2000
"... Stratego is a domainspecic language for the specication of program transformation systems. The design of Stratego is based on the paradigm of rewriting strategies: userdenable programs in a little language of strategy operators determine where and in what order transformation rules are (automat ..."
Abstract

Cited by 23 (13 self)
 Add to MetaCart
Stratego is a domainspecic language for the specication of program transformation systems. The design of Stratego is based on the paradigm of rewriting strategies: userdenable 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 nontrivial 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 domainspecific programming languages within the language itself. Typically, this is realised by designing a set of combinators (higherorder reusable programs) for an application area, and by constr ..."
Abstract

Cited by 21 (3 self)
 Add to MetaCart
The powerful abstraction mechanisms of functional programming languages provide the means to develop domainspecific programming languages within the language itself. Typically, this is realised by designing a set of combinators (higherorder 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 nondeterministic 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 nondeterministic choice needed to handle the natural concurrency that reactive applications entail We demonstrate that this combination of features in a higherorder 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 humanproduced 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 21 (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 humanproduced 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 higherorder programming of a variety of deadcode elimination optimizations that are important in compilers for firstorder 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 analysisbased 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...
TypeBased Useless Variable Elimination
, 1999
"... We show a typebased 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 20 (4 self)
 Add to MetaCart
We show a typebased 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 0CFAbased method in many respects. First, it is efficient: it runs in time almost linear in the size of an input expression for a simplytyped calculus, while the 0CFAbased method may require a cubic time. Second, our transformation can be shown to be optimal among those that preserve welltypedness, both for the simplytyped language and for an MLstyle polymorphicallytyped language. On the other hand, the 0CFAbased method is not optimal for the polymophicallytyped language. ANY OTHER IDENTIFYING INFORMATION OF THIS REPORT Summary has been submitted for publication. Uptodate version of this report will be available through ...
Constructor specialisation for Haskell programs
, 2007
"... Userdefined data types, patternmatching, 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 patternmatching is wasted. Even worse, the argument is sometimes fres ..."
Abstract

Cited by 16 (5 self)
 Add to MetaCart
Userdefined data types, patternmatching, 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 patternmatching is wasted. Even worse, the argument is sometimes freshlyallocated, 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 patternmatching and heap allocation. We describe our implementation of this constructor specialisation transformation in the Glasgow Haskell Compiler, and give measurements of its effectiveness.
Fine Control of Demand in Haskell
 In 6th International Conference on the Mathematics of Program Construction, Dagstuhl
, 2002
"... Functional languages have the Acalculus at their core, but then depart fi'om this fu'm foundation by including features that alter their default evaluation order. The resulting mixed evaluationpartly lazy and partly strictcomplicates the formal semantics of these languages. ..."
Abstract

Cited by 13 (6 self)
 Add to MetaCart
Functional languages have the Acalculus at their core, but then depart fi'om this fu'm foundation by including features that alter their default evaluation order. The resulting mixed evaluationpartly lazy and partly strictcomplicates the formal semantics of these languages.
Higherorder 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 13 (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 wellknown 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 ...
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 simplypolymorphic types rather than the constrainedpolymorphic types usual in such a setting; it achieves this by means of constraint approximation. The algorithm ..."
Abstract

Cited by 11 (0 self)
 Add to MetaCart
We present a novel inference algorithm for a type system featuring subtyping and usage (annotation) polymorphism. This algorithm infers simplypolymorphic types rather than the constrainedpolymorphic 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 usagetype inference.
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 11 (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.