Skip to main content

A grammar-based data-flow analysis to stop deforestation

  • Contributed Papers
  • Conference paper
  • First Online:
Book cover Trees in Algebra and Programming — CAAP'94 (CAAP 1994)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 787))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Nils Andersen. Approximating Term Rewriting systems With Tree Grammars. DIKU-report 86/16, Institute of Datalogy, University of Copenhagen, 1986.

    Google Scholar 

  2. Wei-Ngan Chin. Automatic Methods for Program Transformation. Ph.D. thesis, Imperial College, University of London, July 1990.

    Google Scholar 

  3. Wei-Ngan Chin. Safe Fusion of Functional expressions II: Further Improvements. In Journal of Functional programming. To appear.

    Google Scholar 

  4. A. B. Ferguson & Philip Wadler. When will Deforestation Stop?. In 1988 Glasgow Workshop on Functional Programming. August 1988.

    Google Scholar 

  5. John Hughes. Why Functional Programming Matters. In Research topics in Functional Programming. Ed. D. Turner, Addison-Wesley, 1990.

    Google Scholar 

  6. 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.

    Google Scholar 

  7. 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.

    Google Scholar 

  8. Helmut Seidl. Approximating Functional Programs in Polynomial Time. Unpublished manuscript. 1993.

    Google Scholar 

  9. 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.

    Google Scholar 

  10. 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.

    Google Scholar 

  11. David Turner. An overview of Miranda. In Research topics in Functional Programming. Ed. D. Turner, Addison-Wesley, 1990.

    Google Scholar 

  12. Valentin F. Turchin. The Language REFAL—The Theory of Compilation and Metasystem Analysis. Courant Computer Science Report 20, 1980.

    Google Scholar 

  13. Valentin F. Turchin, Robert M. Nirenberg, Dimitri V. Turchin. Experiments with a Supercompiler. In ACM Symposium on Lisp and Functional Programming. New york, 1982.

    Google Scholar 

  14. 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.

    Google Scholar 

  15. 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.

    Google Scholar 

  16. Philip Wadler. Listlessness is better than lazyness II: Composing Listless functions. In Workshop on Programs as Data objects. LNCS 217, Copenhagen, 1985.

    Google Scholar 

  17. Philip Wadler. Deforestation: Transforming programs to eliminate trees. In European symposium On programming (ESOP). Nancy, France, 1988.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Sophie Tison

Rights and permissions

Reprints 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

Publish with us

Policies and ethics