Nonlinear pattern matching in trees

  • R. Ramesh
  • I. V. Ramakrishnan
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 317)


Tree pattern matching is a fundamental operation that is used in a number of programming tasks such as mechanical theorem proving, term rewriting, symbolic computation and nonprocedural programming languages. In this paper we present new sequential algorithms for nonlinear pattern matching in trees. Our algorithm improves upon known tree pattern matching algorithms in important aspects such as time performance, ease of integration with several reduction strategies and ability to avoid unnecessary computation steps on match attempts that fail. The expected time complexity of our algorithm is linear in the sum of the sizes of the two trees.


Pattern Match Function Symbol Subject Tree Naive Algorithm Label Path 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [1]
    A. V. Aho, J. E. Hopcroft and J. D. Ullman, The Design and Analysis of Computer Algorithms, Addison-Wesley Reading, MA, 1974.Google Scholar
  2. [2]
    A.V. Aho and M.J. Corasick, Efficient String Matching: An Aid to Bibliographic Search, CACM, Vol 18 No. 6, June 1975, pp. 333–340.Google Scholar
  3. [3]
    A.V. Aho and M. Ganapathy, Efficient Tree Pattern Matching: An Aid to Code Generation, Proceedings of the Eleventh ACM Symposium on Principles of Programming Languages, 1984 pp. 334–340.Google Scholar
  4. [4]
    R.S. Boyer and J.S. Moore, A Computational Logic, ACM Monograph Series, Academic Press 1979.Google Scholar
  5. [5]
    B. Buchberger and R. Loos, Algebraic Specification, Computer Algebra and Symbolic and Algebraic Computation, B. Buchberger G.E. Collins and R. Loos, ed., Computing Suppliments 4, Springer-Verlag 1982, pp 11–43.Google Scholar
  6. [6]
    D.R. Chase, An Improvement to Bottom-up Tree Pattern Matching, Fourteenth Annual ACM Symposium on Principles of Programming Languages Munich, West Germany, Jan 1987.Google Scholar
  7. [7]
    M.J. O'Donnell, Equational Logic as a Programming Language, Foundations of Compution Series, MIT Press 1985.Google Scholar
  8. [8]
    P.J. Downey, R. Sethi and R.E. Tarjan, Variations on the Common Subexpression Problem, Journal of the ACM Vol 24 No. 4, 1980, pp. 758–771.Google Scholar
  9. [9]
    K. Futatsugi, J. Goguen, J.A. Jounnaud and J. Meseguer, Principles of OBJ2, Twelfth Annual Symposium on Principles of Programming Languages, New Orleans LA (1985).Google Scholar
  10. [10]
    J.A. Goguen and J. Meseguer, Equality, Types, Modules and Generics for Logic Programming, Proceedings of Second International Logic Programming Conference, Uppsala 1984, pp. 115–125.Google Scholar
  11. [11]
    J. Guttag, E. Horowitz and D. Musser, Abstract Data Types and Software Validation, Information Science Report ISI/RR-76-48, University of Southern California 1976.Google Scholar
  12. [12]
    C.M. Hoffmann and M.J. O'Donnell, Pattern Matching in Trees, JACM 29, 1, 1982 pp. 68–95.Google Scholar
  13. [13]
    G. Huet and D. Oppen, Equations and Rewrite Rules: A survey, Formal Languages: Perspective and Open Problems, R. Book, ed., Academic Press 1980.Google Scholar
  14. [14]
    D. E. Knuth and P. Bendix, Simple word problems in Universal Algebras, Computational Problems in Abstract Algebra, J. Leech, ed., Pergammon Press, Oxford 1970, pp. 263–297.Google Scholar
  15. [15]
    H. Kron, Tree Templates and Subtree Transformational Grammars, Ph.D. Dissertation, University of California, Santa Cruz, 1975.Google Scholar
  16. [16]
    H. Lang, M. Schimmler and H. Schmeck, Matching Tree Patterns Sublinear on the Average, Technical Report, Dept. of Informatik, University of Kiel, W. Germany, 1980.Google Scholar
  17. [17]
    R. Milner, A Proposal for Standard ML, ACM Symposium on LISP and Functional Programming 1984, pp. 184–197.Google Scholar
  18. [18]
    J. Steyaert and P. Flajolet, Patterns and Pattern-Matching in Trees: An Analysis, Information and Control 58, 1983, pp. 19–58.Google Scholar
  19. [19]
    P.A. Subramanyam and J. You, FUNLOG = functions + logic: A Computational Model Integrating Functional and Logic Programming, IEEE International Symposium on Logic Prgramming 1984, pp 144–153.Google Scholar
  20. [20]
    J. van Leeuwen and M.H. Overmars, Rapid Subtree Identification Revisited, Technical Report CS-79-3, University of Utrecht, Netherlands, 1979.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1988

Authors and Affiliations

  • R. Ramesh
    • 1
  • I. V. Ramakrishnan
    • 1
  1. 1.Department of Computer ScienceState University of New York at Stony BrookStony Brook

Personalised recommendations