Skip to main content

Adaptive pattern matching

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 623))

Abstract

Pattern matching is an important operation used in many applications such as functional programming, rewriting and rule-based expert systems. By preprocessing the patterns into a DFA-like automaton, we can rapidly select the matching pattern(s) in a single scan of the relevant portions of the input term. This automaton is typically based on left-to-right traversal (of the patterns) or its variants. By adapting the traversal order to suit the set of input patterns, it is possible to considerably reduce the space and matching time requirements of the automaton. The design of such adaptive automata is the focus of this paper. In this context we study several important problems that have remained open even for automata based on left-to-right traversais. Such problems include upper and lower bounds on space complexity, construction of optimal dag automata and impact of typing in pattern matching. An interesting consequence of our results is that lazy pattern matching in typed systems (such as ML) is computationally hard whereas it can be done efficiently in untyped systems.

Research partially supported by NSF grants CCR-8805734,9102159,9110055 and NYS S&T grant RDG 90173.

This research was completed at SUNY, Stony Brook.

This is a preview of subscription content, log in via an institution.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. L. Augustsson, Compiling Pattern Matching, FPCA '85, LNCS 201.

    Google Scholar 

  2. D. Comer and R. Sethi, Complexity of Trie Index Construction, FOCS '76.

    Google Scholar 

  3. J. Christian, Fast Knuth-Bendix Completion: Summary, RTA '89, LNCS 355.

    Google Scholar 

  4. A. Graf, Left-to-Right Tree Pattern Matching, RTA '91, LNCS 488.

    Google Scholar 

  5. R. Harper, R.Milner and M.Tofte, The Definition of Standard ML, Report ECS-LFCS-88-62, LFCS, University of Edinburgh, 1988.

    Google Scholar 

  6. P. Hudak et al, Report on Haskell, Draft Proposed standard circulated by IFIP WG2.8., 1988.

    Google Scholar 

  7. G. Huet and J.J. Levy, Computations in Nonambiguous Linear Term Rewriting Systems, Tech. Rep. No. 359, INRIA, Le Chesney, France, 1979.

    Google Scholar 

  8. A. Laville, Lazy Pattern Matching in the ML Language, FST&TCS '87.

    Google Scholar 

  9. A. Laville, Implementation of Lazy Pattern Matching Algorithms, ESOP '88, LNCS 300.

    Google Scholar 

  10. K. Owen, S. Pawagi, C. Ramakrishnan, I.V. Ramakrishnan, R.C. Sekar, Fast Parallel Implementation of Functional Languages-The EQUALS Experience, to appear in ]LFP '92.

    Google Scholar 

  11. L. Puel and A. Suarez, Compiling Pattern Matching by Term Decomposition, LFP '90.

    Google Scholar 

  12. Ph. Schnoebelen, Refined Compilation of Pattern Matching for Functional Languages, Science of Computer Programming, 11, pp. 133–159, 1988.

    Article  Google Scholar 

  13. R.C. Sekar, R. Ramesh and I.V. Ramakrishnan, Adaptive Pattern Matching, TR 14/91, SUNY, Stony Brook.

    Google Scholar 

  14. P. Wadler, Efficient Compilation of Pattern Matching, in S.L. Peyton-Jones, Ed, The Implementation of Functional Programming Languages, Prentice Hall International, 1987.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

W. Kuich

Rights and permissions

Reprints and permissions

Copyright information

© 1992 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Sekar, R.C., Ramesh, R., Ramakrishnan, I.V. (1992). Adaptive pattern matching. In: Kuich, W. (eds) Automata, Languages and Programming. ICALP 1992. Lecture Notes in Computer Science, vol 623. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-55719-9_78

Download citation

  • DOI: https://doi.org/10.1007/3-540-55719-9_78

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-55719-7

  • Online ISBN: 978-3-540-47278-0

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics