Better consumers for deforestation
We describe a novel approach to achieve better deforestation by pre-processing a program before subjecting it to actual deforestation. In particular, our approach performs some simple syntactic analyses, and proactively specialises all functions in a program into treeless consumer form. This simplifies greatly the task of deforestation in the later stage. The transformation we use is based on the well-understood fold/unfold strategy with generalisation on terms. We ensure the termination of the transformation. Compared to other existing semantics-based approaches, our syntactic-based approach is considerable simpler, but surprisingly powerful.
KeywordsFunction Call Specialisation Algorithm Recursive Call Derivation Sequence Call Pattern
Unable to display preview. Download preview PDF.
- [CD94]Wei-Ngan Chin and John Darlington. A higher-order removal method. Submitted for Publication, September 1994.Google Scholar
- [Chi92]Wei-Ngan Chin. Safe fusion of functional expressions. In 7th ACM Lisp and Functional Programming Conference, pages 11–20, San Francisco, California, June 1992.Google Scholar
- [CK95]Wei-Ngan Chin and Siau-Cheng Khoo. Better consumers for program specialisation. Technical report, Dept of IS/CS, NUS, August 1995.Google Scholar
- [GLPJ93]A. Gill, J. Launchbury, and S. Peyton-Jones. A short-cut to deforestation. In 6th ACM Conference on Functional Programming Languages and Computer Architecture, Copenhagen, Denmark, June 1993.Google Scholar
- [GS94]R. Glück and Morten H. Sørensen. Partial deduction and driving are equivalent. In PLILP, Madrid, Spain, (Lect. Notes Comput. Sc.), Berlin Heidelberg New York: Springer, 1994.Google Scholar
- [Hol91]Carsten Kehler Holst. Finiteness analysis. In 5th ACM Conference on Functional Programming Languages and Computer Architecture, pages 473–495, Cambridge, Massachusetts, August 1991.Google Scholar
- [PP91]M. Proietti and A. Pettorossi. Unfolding — definition — folding, in this order for avoiding unnecessary variables in logic programs. In Proceedings of PLLLP, Passau, Germany, (Lect. Notes Comput. Sc., vol 528, pp. 347–258) Berlin Heidelberg New York: Springer, 1991.Google Scholar
- [RFJ89]C. Runciman, M. Firth, and N. Jagger. Transformation in a non-strict language: An approach to instantiation. In Glasgow Functional Programming Workshop, August 1989.Google Scholar
- [SF93]T. Sheard and L. Fegaras. A fold for all seasons. In 6th ACM Conference on Functional Programming Languages and Computer Architecture, Copenhagen, Denmark, June 1993.Google Scholar
- [Sør94]Morten H. Sørensen. A grammar-based data-flow analysis to stop deforestation. In Colloquium on Trees and Algebra in Programming (CAAP) LNCS 787, Edinburgh, April 1994.Google Scholar
- [Thi93]Peter Thiemann. Avoiding repeated tests in pattern-matching. In 3rd International Workshop on Static Analysis, Padova, Italy, (Lect. Notes Comput. Sc., vol 724, pp. 141–152) Berlin Heidelberg New York: Springer, 1993.Google Scholar
- [Wad88]Phil Wadler. Deforestation: Transforming programs to eliminate trees. In European Symposium on Programming, pages 344–358, Nancy, France, March 1988.Google Scholar