Abstract
We study the problem to transform functional programs, which intensively use append functions (like inefficient list reversal), into programs, which use accumulating parameters instead (like eficient list reversal). We give an (automatic) transformation algorithm for our problem and identify a class of functional programs, namely restricted 2-modular tree transducers, to which it can be applied. Moreover, since we get macro tree transducers as transformation result and since we also give the inverse transformation algorithm, we have a new characterization for the class of functions induced by macro tree transducers.
Research supported in part by the German Academic Exchange Service (DAAD).
Research supported in part by the Japan Science and Technology Corporation (JST).
Research fellow of the Japan Society for the Promotion of Science (JSPS).
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
R. M. Burstall and J. Darlington. A transformation system for developing recursive programs. J. Assoc. Comput. Mach., 24:44–67, 1977.
W.-N. Chin. Safe fusion of functional expressions II: Further improvements. Journal of Functional Programming, 4:515–555, 1994.
O. Chitil. Type-inference based short cut deforestation (nearly) without inlining. In IFL’99, Lochem, The Netherlands, Proceedings, September 1999, volume 1868 of LNCS, pages 19–36. Springer-Verlag, April 2000.
B. Courcelle and P. Franchi-Zannettacci. Attribute grammars and recursive program schemes. Theor. Comp. Sci., 17:163–191, 235–257, 1982.
J. Engelfriet. Some open questions and recent results on tree transducers and tree languages. In R.V. Book, editor, Formal language theory; perspectives and open problems, pages 241–286. New York, Academic Press, 1980.
J. Engelfriet and H. Vogler. Macro tree transducers. J. Comp. Syst. Sci., 31:71–145, 1985.
J. Engelfriet and H. Vogler. Modular tree transducers. Theor. Comp. Sci., 78:267–304, 1991.
Z. Fülöp. On attributed tree transducers. Acta Cybernetica, 5:261–279, 1981.
Z. Fülöp, F. Herrmann, S. Vágvölgyi, and H. Vogler. Tree transducers with external functions. Theor. Comp. Sci., 108:185–236, 1993.
Z. Fülöp and H. Vogler. Syntax-directed semantics — Formal models based on tree transducers. Monographs in Theoretical Computer Science. Springer-Verlag, 1998.
H. Ganzinger. Increasing modularity and language-independency in automatically generated compilers. Science of Computer Programming, 3:223–278, 1983.
R. Giegerich. Composition and evaluation of attribute coupled grammars. Acta Informatica, 25:355–423, 1988.
A. Gill. Cheap deforestation for non-strict functional languages. PhD thesis, University of Glasgow, 1996.
A. Gill, J. Launchbury, and S.L. Peyton Jones. A short cut to deforestation. In FPCA’93, Copenhagen, Denmark, Proceedings, pages 223–231. ACM Press, 1993.
M. Höff. Vergleich von Verfahren zur Elimination von Zwischenergebnissen bei funktionalen Programmen. Master’s thesis, Dresden University of Technology, 1999.
D.E. Knuth. Semantics of context-free languages. Math. Syst. Th., 2:127–145, 1968. Corrections in Math. Syst. Th., 5:95–96, 1971.
A. Kühnemann. Benefits of tree transducers for optimizing functional programs. In FST & TCS’98, Chennai, India, Proceedings, volume 1530 of LNCS, pages 146–157. Springer-Verlag, December 1998.
A. Kühnemann. Comparison of deforestation techniques for functional programs and for tree transducers. In FLOPS’99, Tsukuba, Japan, Proceedings, volume 1722 of LNCS, pages 114–130. Springer-Verlag, November 1999.
W.C. Rounds. Mappings and grammars on trees. Math. Syst.Th., 4:257–287, 1970.
M. H. Sørensen, R. Glück, and N. D. Jones. A positive supercompiler. Journal of Functional Programming, 6:811–838, 1996.
J.W. Thatcher. Generalized 2 sequential machine maps. J. Comp. Syst. Sci., 4:339–367, 1970.
V. F. Turchin. The concept of a supercompiler. ACM TOPLAS, 8:292–325, 1986.
P. Wadler. The concatenate vanishes. Note, University of Glasgow, December 1987 (Revised, November 1989).
P. Wadler. Deforestation: Transforming programs to eliminate trees. Theor. Comp. Sci., 73:231–248, 1990.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2001 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Kühnemann, A., Glück, R., Kakehi, K. (2001). Relating Accumulative and Non-accumulative Functional Programs. In: Middeldorp, A. (eds) Rewriting Techniques and Applications. RTA 2001. Lecture Notes in Computer Science, vol 2051. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45127-7_13
Download citation
DOI: https://doi.org/10.1007/3-540-45127-7_13
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-42117-7
Online ISBN: 978-3-540-45127-3
eBook Packages: Springer Book Archive