Advertisement

Transformation of attributed trees using pattern matching

  • Josef Grosch
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 641)

Abstract

This paper describes a tool for the transformation of attributed trees using pattern matching. The trees to be processed are defined by a formalism based on contextfree grammars. Operations for trees such as composition and decomposition are provided. The approach can be characterized as an amalgamation of trees or terms including pattern matching, with recursion, attribute grammars, and imperative programming. Transformations can either modify the input trees or map them to arbitrary output. Possible applications are the various transformation tasks in compilers such as semantic analysis, optimization, or the generation of intermediate representations. The design goals have been to combine an expressive and high level technique for transformation with flexibility, efficiency, and practical usability. A reliable development style is supported by static typing and checks for the single assignment property of variables. We give some example transformations and describe the input language of our tool called puma. The relationship to similar work is discussed. Finally, experimental results are presented that demonstrate the efficiency of our approach.

Keywords

transformation attributed trees pattern matching 

References

  1. [AGT89]
    A. V. Aho, M. Ganapathi and S. W. K. Tjiang, Code Generation Using Tree Matching and Dynamic Programming, ACM Trans. Prog. Lang. and Systems 11, 4 (Oct. 1989), 491–516.Google Scholar
  2. [BMS80]
    R. Burstall, D. MacQueen and D. Sannella, HOPE: An Experimental Applicative Language, Report CSR-62-80, Computer Science Department, Edinburgh, 1980.Google Scholar
  3. [CaC91]
    I. H. Carmichael and J. R. Cordy, TXL — Tree Transformation Language, Syntax and Informal Semantics, Dept. of Computing and Information Sciences, Queens's Univeristy, Kingston, Apr. 1991.Google Scholar
  4. [ClM84]
    W. F. Clocksin and C. S. Mellish, Programming in Prolog, Springer Verlag, Berlin, 1984.Google Scholar
  5. [CoP90]
    J. R. Cordy and E. Promislow, Specification and Automatic Prototype Implementation of Polymorphic Objects in TURING using the TXL Dialect Processor, Proc. IEEE 1990 International Conference on Computer Languages, New Orleans, Mar. 1990, 145–154.Google Scholar
  6. [ESL89]
    H. Emmelmann, F. W. Schröer and R. Landwehr, BEG — a Generator for Efficient Back Ends, SIGPLAN Notices 24, 7 (July 1989), 227–237.Google Scholar
  7. [Gro89]
    J. Grosch, Ag — An Attribute Evaluator Generator, Compiler Generation Report No. 16, GMD Forschungsstelle an der Universität Karlsruhe, Aug. 1989.Google Scholar
  8. [GrE90]
    J. Grosch and H. Emmelmann, A Tool Box for Compiler Construction, LNCS 477, (Oct. 1990), 106–116, Springer Verlag.Google Scholar
  9. [Gro91a]
    J. Grosch, Puma — A Generator for the Transformation of Attributed Trees, Compiler Generation Report No. 26, GMD Forschungsstelle an der Universität Karlsruhe, July 1991.Google Scholar
  10. [Gro91b]
    J. Grosch, Tool Support for Data Structures, Structured Programming 12, (1991), 31–38.Google Scholar
  11. [HeS91]
    R. Heckmann and G. Sander, Trafola-H Reference Manual, Prospectra Project Report, Universität des Saarlandes, Saarbrücken, 1991.Google Scholar
  12. [IRD91]
    IRDATA, Industrial Robot Data, DIN 66313, Beuth-Verlag, Berlin, 1991.Google Scholar
  13. [IRL92]
    IRL, Industrial Robot Language, DIN 66312, Beuth-Verlag, Berlin, to appear, 1992.Google Scholar
  14. [JoP90]
    M. Jourdan and D. Parigot, Application Development with the FNC-2 Attribute Grammar System, LNCS 477, (Oct. 1990), 11–25, Springer Verlag.Google Scholar
  15. [KHZ82]
    U. Kastens, B. Hutt and E. Zimmermann, GAG: A Practical Compiler Generator, Springer Verlag, Heidelberg, 1982.Google Scholar
  16. [Knu68]
    D. E. Knuth, Semantics of Context-Free Languages, Mathematical Systems Theory 2, 2 (June 1968), 127–146.CrossRefGoogle Scholar
  17. [Kos71]
    C. H. A. Koster, Affix Grammars, in ALGOL 68 Implementation, J. E. L. Peck (ed.), North Holland, Amsterdam, 1971, 95–109.Google Scholar
  18. [Kos77]
    C. H. A. Koster, CDL: A Compiler Implementation Language, LNCS 47, (1977), 341–351, Springer Verlag.Google Scholar
  19. [LMO88]
    P. Lipps, U. Möncke, M. Olk and R. Wilhelm, Attribute (Re)evaluation in OPTRAN, Acta Inf. 26, (1988), 213–239.Google Scholar
  20. [LMW89]
    P. Lipps, U. Möncke and R. Wilhelm, OPTRAN — A Language/System for the Specification of Program Transformations, System Overview and Experiences, LNCS 371, (1989), 52–65, Springer Verlag.Google Scholar
  21. [MAE65]
    J. McCarthy, P. W. Abrahams, D. J. Edwards, T. R. Hart and M. I. Levin, Lisp 1.5 Programmer's Manual, MIT Press, Cambridge, MA, 1965.Google Scholar
  22. [Mil85]
    R. Milner, The Standard ML Core Language, Polymorphism 2, 2 (1985),.Google Scholar
  23. [NAJ76]
    K. V. Nori, U. Ammann, K. Jensen, H. H. Nägeli and C. Jacobi, The Pascal-P Compiler: Implementation Notes, Bericht 10, Eidgenössische Technische Hochschule, Zürich, July 1976.Google Scholar
  24. [Paa89]
    J. Paakki, A Prolog-Based Compiler Writing Tool, in Proceedings of the Workshop on Compiler Compiler and High Speed Compilation, D. Hammer (ed.), Berlin, GDR, 1989, 107–117.Google Scholar
  25. [Tur85]
    D. A. Turner, Miranda: A Nonstrict Functional Language with Polymorphic Types, LNCS 201, (1985), 1–16, Springer Verlag.Google Scholar
  26. [Vol91]
    J. Vollmer, The Compiler Construction System GENTLE, GMD-Arbeitspapier Nr. 508, GMD Forschungsstelle an der Universität Karlsruhe, Feb. 1991.Google Scholar
  27. [WGS89]
    W. M. Waite, J. Grosch and F. W. Schröer, Three Compiler Specifications, GMD-Studie Nr. 166, GMD Forschungsstelle an der Universität Karlsruhe, Aug. 1989.Google Scholar
  28. [Wat74]
    D. A. Watt, Analysis Oriented Two Level Grammars, Ph. D. thesis, University of Glasgow, Glasgow, 1974.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1992

Authors and Affiliations

  • Josef Grosch
    • 1
  1. 1.GMD Forschungsstelle an der Universität KarlsruheKarlsruheGermany

Personalised recommendations