Results 1 -
4 of
4
Constraints to Stop Higher-Order Deforestation
- In 24th ACM Symposium on Principles of Programming Languages
, 1997
"... Wadler's deforestation algorithm eliminates intermediate data structures from functional programs. To be suitable for inclusion in a compiler, it must terminate on all programs. Several techniques to ensure termination of deforestation on all first-order programs are known, but a technique for highe ..."
Abstract
-
Cited by 11 (1 self)
- Add to MetaCart
Wadler's deforestation algorithm eliminates intermediate data structures from functional programs. To be suitable for inclusion in a compiler, it must terminate on all programs. Several techniques to ensure termination of deforestation on all first-order programs are known, but a technique for higher-order programs was only recently introduced by Hamilton, and elaborated and implemented in the Glasgow Haskell compiler by Marlow. We introduce a new technique for ensuring termination of deforestation on all higher-order programs that allows useful transformation steps prohibited in Hamilton's and Marlowe's techniques. 1 Introduction Lazy, higher-order, functional programming languages lend themselves to a certain style of programming which uses intermediate data structures [28]. Example 1 Consider the following program. letrec a = x; y:case x of [] ! y (h : t) ! h : a t y in u; v; w: a (a u v) w The term u; v; w:a (a u v) w appends the three lists u, v, and w. Appending u and v ...
Integer Constraints to Stop Deforestation
, 1996
"... . Deforestation is a transformation of functional programs to remove intermediate data structures. It is based on outermost unfolding of function calls where folding occurs when unfolding takes place within the same nested function call. Since unrestricted unfolding may encounter arbitrarily man ..."
Abstract
-
Cited by 10 (2 self)
- Add to MetaCart
. Deforestation is a transformation of functional programs to remove intermediate data structures. It is based on outermost unfolding of function calls where folding occurs when unfolding takes place within the same nested function call. Since unrestricted unfolding may encounter arbitrarily many terms, a termination analysis has to determine those subterms where unfolding is possibly dangerous. We show that such an analysis can be obtained from a control flow analysis by an extension with integer constraints -- essentially at no loss in efficiency. 1 Introduction The key idea of flow analysis for functional languages is to define an abstract meaning in terms of program points , i.e., subexpressions of the program possibly evaluated during program execution [Pa95]. Such analysises have been invented for tasks like type recovery [Sh91], binding time analysis [Co93], or safety analysis [PS95]. Conceptually, these are closely related to A. Deutsch's store--based alias analysis [D...
Realistic Compilation by Partial Evaluation
- In ACM SIGPLAN ’96 Conference On Programming Language Design and Implementation
, 1996
"... Two key steps in the compilation of strict functional languages are the conversion of higher-order functions to data structures (clo- sures) and the transformation to tail-recursive style. We show how to perform both steps at once by applying first-order offline partial evaluation to a suitable inte ..."
Abstract
-
Cited by 8 (1 self)
- Add to MetaCart
Two key steps in the compilation of strict functional languages are the conversion of higher-order functions to data structures (clo- sures) and the transformation to tail-recursive style. We show how to perform both steps at once by applying first-order offline partial evaluation to a suitable interpreter. The resulting code is easy to transliterate to low-level C or native code. We have implemented the compilation to C; it yields a performance comparable to that of other modern Scheme-to-C compilers. In addition, we have integrated various optimizations such as constant propagation, higherorder removal, and arity raising simply by modifying the underlying interpreter. Purely first-order methods suffice to achieve the transformations. Our approach is an instance of semantics-directed compiler generation.
Bootstrapping Higher-Order Program Transformers from Interpreters
- IN PROCEEDINGS OF THE 1996 ACM SYMPOSIUM ON APPLIED COMPUTING
, 1996
"... Partial evaluation can automatically generate program transformers from interpreters. In the context of functional languages, we investigate the design space of higher-order interpreters to achieve certain transformation effects. The present work is based on the interpretive approach and exploits th ..."
Abstract
-
Cited by 6 (4 self)
- Add to MetaCart
Partial evaluation can automatically generate program transformers from interpreters. In the context of functional languages, we investigate the design space of higher-order interpreters to achieve certain transformation effects. The present work is based on the interpretive approach and exploits the language preservation property of offline partial evaluators. We have generated higher-order online partial evaluators, optimizing closure converters, and converters to first-order tail form. The latter can serve as the middle end of a compiler. The generated transformers are strictly more powerful than the partial evaluators used for their generation. A simple-minded partial evaluator for a first-order language suffices to generate the above transformers. Self-application of a partial evaluator with respect to an interpreter produces a compiler. We investigate the generatation of optimizing program transformers from interpreters. We study different types of interpreters for a strict, high...

