Toward a calculus for abstract syntax trees

  • D. S. Wile
Part of the IFIP Advances in Information and Communication Technology book series (IFIPAICT)


Metaprogramming — writing programs that manipulate programs as data — requires a formal foundation in order that people be able to reason about the effects of their metaprograms. Of equal importance, metaprogramming requires an intuitive foundation that facilitates most frequent, natural manipulations of programs as data. In the past, the program transformation community has characterized well means for expressing pattern-matching and individual transformations. This report concentrates on developing a calculus for characterizing transformation application by providing operators on abstract syntax trees and studying their relationships. The work builds directly on the Theory of Lists developed by Meertens and Bird and an extension to the Theory of Binary Labeled Trees developed by Gibbons. Although the foundations for the theory lie in category theory, the presentation should be accessible to a wide audience interested in program manipulation systems.


Metaprogramming programming calculus transformations abstract syntax trees 


  1. Bird, R.S. (1987) An introduction to the Theory of Lists. in Logic of Programming and Calculi of Discrete Design (ed. M. Broy), Springer-Verlag, 3–42.Google Scholar
  2. Donzeau-Gouge, V., Kahn, G., Lang, B., and Mélèse, B. (1984) Document structure and modularity in Mentor. in Proceedings of the ACM SIGSOFT/SIGPLAN Software Symposium on Practical Software Development Environments, 141–148.CrossRefGoogle Scholar
  3. Gibbons, J. (1991) Algebras for Tree Algorithms. Ph.D. Thesis, Programming Research Group, Oxford University.Google Scholar
  4. Gibbons, J. (1993) Upwards and downwards accumulations on trees. in LNCS 669: Mathematics of Program Construction (eds. R. S. Bird, C. C. Morgan, and J. C. P. Woodcock), Springer-Verlag, 122–138.CrossRefGoogle Scholar
  5. Gibbons, J. (1994) An initial-algebra approach to directed acyclic graphs. in Mathematics of Program Construction, ed. B. Möller, LNCS 947, Springer-Verlag. 122–138.Google Scholar
  6. Goldman, N. M. (1989) Code walking and recursive descent: a generic approach. in Lisp and Functional Programming Conference.Google Scholar
  7. Heckmann, R. (1988) A functional language for the specification of complex tree transformations. in Proceedings of the 2nd European Symposium on Programming. Springer-Verlag, 175–190.Google Scholar
  8. Hudak, P., Jones, S. P., and Wadler, P. (1992) Report on the programming language Haskell. Yale Computer Science report YALEU/DCS/RR-777.Google Scholar
  9. Huet, G. and Lang, B. (1978) Proving and applying program transformations expressed with second-order patterns. Acta Informatica 11 (1). 31–55.zbMATHMathSciNetCrossRefGoogle Scholar
  10. Jeuring, J., and Swierstra, S. D. (1995) Constructing functional programs for grammar analysis problems. in Proceedings of a Conference on Functional Programming Languages and Computer Architecture, La Jolla, CA, USA, 259–269.Google Scholar
  11. Jones, G. and Gibbons, J. (1993) Linear-time breadth-first tree algorithms: an exercise in the arithmetic of folds and zips. IFIP Working Group 2.1 working paper 705: WIN 2, University of Auckland Computer Science Report No. 71.Google Scholar
  12. Kibler, D. (1978) Power, Efficiency, and Correctness of Transformation Systems. Ph.D. Thesis. University of California, Irvine.Google Scholar
  13. Lieberherr, K. (1995) Adaptive Object-Oriented Software: the Demeter Method with Propagation Patterns. PWS Publishing Company, Boston.Google Scholar
  14. Malcolm, G. (1990) Data structures and program transformation. Science of Computer Programming 14. 255–280.zbMATHMathSciNetCrossRefGoogle Scholar
  15. Meertens, L. (1988) First steps toward the theory of rose trees. IFIP Working Group 2.1 working paper 592: ROM 25, CWI, Amsterdam.Google Scholar
  16. Meertens, L. (1992) Paramorphisms. In Formal Aspects of Computing 4. 413–425.zbMATHCrossRefGoogle Scholar
  17. Paulson, L. (1983) A higher-order implementation of rewriting. in Science of Computer Programming 3, 119–149.Google Scholar
  18. Reps, T. (1982) Optimal-time incremental semantic analysis for syntax-directed editors. in Ninth Annual ACM Symposium on the Principles of Programming Languages, 169–176.Google Scholar
  19. Runciman, C. (1989) Another look at labeled trees. IFIP Working Group 2.1 working paper 621: JVL 2, University of York.Google Scholar
  20. Wile, D. S. (1986) Organizing programming knowledge into syntax-directed experts. in Proceedings of an International Workshop on Advanced Programming Environments, WG2.4, Trondheim, Norway, June.Google Scholar
  21. Wile, D. S. (1988) Definitions toward the theory of labeled tree expressions. IFIP Working Group 2.1 working paper: CHM 8, USC/Information Sciences Institute.Google Scholar
  22. Wile, D. S. (1991). Popart Manual. USC/Information Sciences Institute. 1991.Google Scholar
  23. Wile, D. S. (1996) Abstract syntax from concrete syntax. Working Group 2.1 working paper, Rancho Santa Fe, CA. (To appear in ICSE 97 ).Google Scholar

Copyright information

© IFIP 1997

Authors and Affiliations

  • D. S. Wile
    • 1
  1. 1.University of Southern California/Information Sciences InstituteMarina del ReyUSA

Personalised recommendations