Optimal left-to-right pattern-matching automata

  • Nadia Nedjah
  • Colin D. Walter
  • Stephen E. Eldridge
Theorem Proving Methods
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1298)

Abstract

We propose a practical technique to compile pattern-matching for prioritised overlapping patterns in equational languages into a minimal, deterministic, left-to-right, matching automaton. First, we present a method for constructing a tree matching automaton for such patterns. This allows pattern-matching to be performed without any backtracking. Space requirements are reduced by using a directed acyclic graph (dag) automaton that shares all the isomorphic subautomata which are duplicated in the tree automaton. We design an efficient method to identify such subautomata and avoid duplicating their construction while generating the dag automaton. We conclude with some easily computed bounds on the size of the automata, thereby improving on previously known equivalent bounds for the tree automaton.

Keywords

Term rewriting system pattern-matching tree automaton dag automaton 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [1]
    Aho, A.V., Sethi, R. and Ulmann, J.D., Compilers: Principles, Techniques and Tools, Addison-Wesley Publishing Company, 1986.Google Scholar
  2. [2]
    Gräf, A., “Left-to-Right Pattern-Matching”, in Proc. Rewriting Techniques and Applications, Lecture Notes in Computer Science, Vol. 488, pp. 323–334, Springer Verlag, 1991.Google Scholar
  3. [3]
    Hoffman, C.M. and O'Donnell, M.J., “Pattern-Matching in Trees”, Journal of the ACM, Vol 29, pp. 68–95, January 1982.Google Scholar
  4. [4]
    Hoffman, C.M., O'Donnell, M.J. and Strandh, R. “Programming with Equations”, Software, Practice and Experience, Vol. 15, No. 12, pp. 1185–1204, December 1985.Google Scholar
  5. [5]
    Johnson, S. C., Yacc — Yet Another Compiler Compiler, Computing Science Technical Report 32, AT&T Laboratories, Murray Hill, N. J., 1975.Google Scholar
  6. [6]
    Kennaway, J. R., “The Specificity Rule for Lazy Pattern Matching in Ambiguous Term Rewriting Systems”, Proc. 3rd European Symposium on Programming, Lecture Notes in Computer Science, Vol. 432, pp. 256–270, Springer-Verlag,1990.Google Scholar
  7. [7]
    Knuth, D.E., Morris, J. and Pratt, V., “Fast Pattern-Matching in Strings”, SIAM Journal on Computing, Vol. 6, No. 2, pp. 323–350, 1977.Google Scholar
  8. [8]
    Nedjah, N., Pattern-Matching Automata for Efficient Evaluation in Equational Programming, Ph.D. Thesis, UMIST, Manchester, UK, 1997.Google Scholar
  9. [9]
    Nedjah, N., Walter, C.D. and Eldridge, S.E., Efficient Automaton-Driven Pattern-Matching for Equational Programs, Technical Report, Computation Dept., UMIST, Manchester, UK, 1996.Google Scholar
  10. [10]
    O'Donnell, M.J., Equational Logic as a Programming Language, The MIT Press, 1985.Google Scholar
  11. [11]
    Sekar, R.C., Ramesh, R. and Ramakrishnan, I.V., “Adaptive Pattern Matching”, SIAM Journal on Computing, Vol. 24, No. 5, pp. 1207–1234, December 1995.Google Scholar

Copyright information

© Springer-Verlag 1997

Authors and Affiliations

  • Nadia Nedjah
    • 1
  • Colin D. Walter
    • 1
  • Stephen E. Eldridge
    • 1
  1. 1.Computation Dept.UMISTManchesterUK

Personalised recommendations