Efficient Pattern Matching for Non-strongly Sequential Term Rewriting Systems

  • Nadia Nedjah
  • Luiza de Macedo Mourelle
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2718)


Pattern matching is a fundamental feature in many applications such as rule-based expert systems. Usually, patterns are pre-processed into a deterministic finite automaton. With ambiguous patterns a subject term may be an instance of more than one pattern and so a priority rule is usually engaged to select the matched pattern. The pre-processing of the patterns adds new patterns, which are instances of the original ones. When the original patterns are ambiguous, some of the instances supplied may be irrelevant. Their introduction causes unnecessary increase of space requirements. Furthermore, they slow down the matching process. Here, we devise a new pre-processing operation that identifies and avoids including such irrelevant instances and hence improves space and time requirements for the matching automaton and process.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    A. Augustsson, A Compiler for lazy ML, Proc. Conference on Lisp and Functional Programming, ACM, pp. 218–227, 1984.Google Scholar
  2. 2.
    J. Christian, Flatterms, Discrimination nets and fast term rewriting, Journal of Automated Reasoning, vol. 10, pp. 95–113, 1993.CrossRefMathSciNetGoogle Scholar
  3. 3.
    D. Cooper and N. Wogrin, Rule-based programming with OPS5, Morgan Kaufmann, San Francisco, 1988.Google Scholar
  4. 4.
    N. Dershowitz and J.P. Jouannaud, Rewrite systems, Handbook of Theoretical Computer Science, vol. 2, chap. 6, Elsevier Science, 1990.Google Scholar
  5. 5.
    A.J. Field and P.G. Harrison, Functional programming, International Computer Science Series, 1988.Google Scholar
  6. 6.
    J.A Goguen and T. Winkler, Introducing OBJ3, Technical report SRI-CSL-88-9, Computer Science Laboratory, SRI International, 1998.Google Scholar
  7. 7.
    A. Gräf, Left-to-right tree pattern matching, Proc. Conference on Rewriting Techniques and Applications, Lecture Notes in Computer Science, vol. 488, pp. 323–334, 1991.Google Scholar
  8. 8.
    C.M. Hoffman and M.J. O’Donnell, Pattern matching in trees, Journal of ACM, vol. 29, no 1, pp. 68–95, 1982.CrossRefGoogle Scholar
  9. 9.
    P. Hudak and al., Report on the programming language Haskell: a Non-Strict, Purely Functional Language, Sigplan Notices, Section S, May 1992.Google Scholar
  10. 10.
    A. Laville, Comparison of priority rules in pattern matching and term rewriting, Journal of Symbolic Computation, no 11, pp. 321–347, 1991.MATHMathSciNetCrossRefGoogle Scholar
  11. 11.
    N. Nedjah, C.D. Walter and S.E. Eldridge, Optimal left-to-right pattern matching automata, Proc. Conference on Algebraic and Logic Programming, Southampton, UK, Lecture Notes in Computer Science, M. Hanus, J. Heering and K. Meinke Eds., Springer-Verlag, vol. 1298, pp. 273–285, 1997.CrossRefGoogle Scholar
  12. 12.
    N. Nedjah, Postponing redex contractions in equational programs, Proc. Symposium on Functional and Logic Programming, Kyoto, Japan, M. Sato and Y. Toyama Eds., World Scientific, pp. 40–60, 1998.Google Scholar
  13. 13.
    N. Nedjah, C.D. Walter and S.E. Eldridge, Efficient automata-driven pattern matching for equational programs, Software-Practice and Experience, vol. 29, no 9, pp. 793–813, John Wiley, 1999.CrossRefGoogle Scholar
  14. 14.
    N. Nedjah and L.M. Mourelle, Dynamic deterministic pattern matching, Proc. Computing: the Australasian Theory Symposium, Canberra, Australia, D.A. Wolfram Ed., Electronic Notes in Theretical Computer Science, Elsevier Science, vol. 31, 2000.Google Scholar
  15. 15.
    N. Nedjah and L.M. Mourelle, Improving time, space and termination in term rewriting-based programming, Proc. International Conference on Industrial & Engineering Applications of Artificial Intelligence & Expert Systems, Budapest, Hungary, Lecture Notes in Computer Science, L. Monostori, J. Váncsa and A. M. Ali Eds., Springer-Verlag, vol. 2070, pp. 880–890, June 2001.Google Scholar
  16. 16.
    N. Nedjah and L.M. Mourelle, Optimal Adaptive Pattern-Matching, Proc. International Conference on Industrial & Engineering Applications of Artificial Intelligence & Expert Systems, Cairn, Australia, Lecture Notes in Computer Science, T. Hendtlass and A. M. Ali Eds., Springer-Verlag, vol. 2358, pp. 768–779, June 2002.Google Scholar
  17. 17.
    M.J. O’Donnell, Equational logic as programming language, MIT Press, 1985.Google Scholar
  18. 18.
    R.C. Sekar, R. Ramesh and I.V. Ramakrishnan, Adaptive pattern matching, SIAM Journal, vol. 24, no 5, pp. 1207–1234, 1995.MATHCrossRefMathSciNetGoogle Scholar
  19. 19.
    D.A. Turner, Miranda: a Non strict functional language with polymorphic Types, Proc. Conference on Lisp and Functional Languages, ACM, pp. 1–16, 1985.Google Scholar
  20. 20.
    P. Wadler, Efficient compilation of pattern matching, In “The Implementation of Functional Programming Languages”, S. L. Peyton-Jones, Prentice-Hall International, pp. 78–103, 1987.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Nadia Nedjah
    • 1
  • Luiza de Macedo Mourelle
    • 1
  1. 1.Department of Systems Engineering and Computation, Faculty of EngineeringState University of Rio de JaneiroRio de JaneiroBrazil

Personalised recommendations