Abstract
Wadler's deforestation algorithm removes intermediate data structures from functional programs, but is only guaranteed to terminate for treeless programs. Chin has shown how one can apply deforestation to all first-order programs: annotate non-treeless subterms and apply the extended deforestation algorithm which essentially leaves annotated subterms untransformed. We develop a new technique of putting annotations on programs. The basic idea is to compute a finite grammar which approximates the set of terms that the deforestation algorithm encounters. The technique extends Wadler's and Chin's in a certain sense.
Preview
Unable to display preview. Download preview PDF.
References
Nils Andersen. Approximating Term Rewriting systems With Tree Grammars. DIKU-report 86/16, Institute of Datalogy, University of Copenhagen, 1986.
Wei-Ngan Chin. Automatic Methods for Program Transformation. Ph.D. thesis, Imperial College, University of London, July 1990.
Wei-Ngan Chin. Safe Fusion of Functional expressions II: Further Improvements. In Journal of Functional programming. To appear.
A. B. Ferguson & Philip Wadler. When will Deforestation Stop?. In 1988 Glasgow Workshop on Functional Programming. August 1988.
John Hughes. Why Functional Programming Matters. In Research topics in Functional Programming. Ed. D. Turner, Addison-Wesley, 1990.
Neil D. Jones. Flow analysis of Lazy higher-order functional programs. In Abstract Interpretation of Declarative Languages. Eds. Samson Abramsky & Chris Hankin, Ellis Horwood, London, 1987.
Torben Mogensen. Partially Static Structures in a Self-applicable Partial Evaluator. In Partial Evaluation and Mixed Computation. Eds. A. P. Ershov, D. Bjrner & N. D. Jones, North-Holland, 1988.
Helmut Seidl. Approximating Functional Programs in Polynomial Time. Unpublished manuscript. 1993.
Morten Heine Sørensen. A New Means of Ensuring Termination of Deforestation. Student Project 93-8-3, DIKU, Department of Computer Science, University of Copenhagen, 1993.
Morten Heine Sørensen, Robert Glück, Neil D. Jones. Towards Unifying Partial Evaluation, Deforestation, Supercompilation, and GPC. In European Symposium On Programming'94. To appear as LNCS, 1994.
David Turner. An overview of Miranda. In Research topics in Functional Programming. Ed. D. Turner, Addison-Wesley, 1990.
Valentin F. Turchin. The Language REFAL—The Theory of Compilation and Metasystem Analysis. Courant Computer Science Report 20, 1980.
Valentin F. Turchin, Robert M. Nirenberg, Dimitri V. Turchin. Experiments with a Supercompiler. In ACM Symposium on Lisp and Functional Programming. New york, 1982.
Valentin F. Turchin. The Algorithm of Generalization in the Supercompiler. In Partial Evaluation and Mixed Computation Eds. A. P. Ershov, D. Bjrner & N. D. Jones North-Holland, 1988.
Phillip Wadler. Listlessness is better than lazyness: Lazy evaluation and garbage collection at compile-time. In ACM Symposium on Lisp and Functional Programming. Austin, Texas, 1984.
Philip Wadler. Listlessness is better than lazyness II: Composing Listless functions. In Workshop on Programs as Data objects. LNCS 217, Copenhagen, 1985.
Philip Wadler. Deforestation: Transforming programs to eliminate trees. In European symposium On programming (ESOP). Nancy, France, 1988.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1994 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Sørensen, M.H. (1994). A grammar-based data-flow analysis to stop deforestation. In: Tison, S. (eds) Trees in Algebra and Programming — CAAP'94. CAAP 1994. Lecture Notes in Computer Science, vol 787. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0017492
Download citation
DOI: https://doi.org/10.1007/BFb0017492
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-57879-6
Online ISBN: 978-3-540-48373-1
eBook Packages: Springer Book Archive