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.
References
L. Augustsson, Compiling Pattern Matching, FPCA '85, LNCS 201.
D. Comer and R. Sethi, Complexity of Trie Index Construction, FOCS '76.
J. Christian, Fast Knuth-Bendix Completion: Summary, RTA '89, LNCS 355.
A. Graf, Left-to-Right Tree Pattern Matching, RTA '91, LNCS 488.
R. Harper, R.Milner and M.Tofte, The Definition of Standard ML, Report ECS-LFCS-88-62, LFCS, University of Edinburgh, 1988.
P. Hudak et al, Report on Haskell, Draft Proposed standard circulated by IFIP WG2.8., 1988.
G. Huet and J.J. Levy, Computations in Nonambiguous Linear Term Rewriting Systems, Tech. Rep. No. 359, INRIA, Le Chesney, France, 1979.
A. Laville, Lazy Pattern Matching in the ML Language, FST&TCS '87.
A. Laville, Implementation of Lazy Pattern Matching Algorithms, ESOP '88, LNCS 300.
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.
L. Puel and A. Suarez, Compiling Pattern Matching by Term Decomposition, LFP '90.
Ph. Schnoebelen, Refined Compilation of Pattern Matching for Functional Languages, Science of Computer Programming, 11, pp. 133–159, 1988.
R.C. Sekar, R. Ramesh and I.V. Ramakrishnan, Adaptive Pattern Matching, TR 14/91, SUNY, Stony Brook.
P. Wadler, Efficient Compilation of Pattern Matching, in S.L. Peyton-Jones, Ed, The Implementation of Functional Programming Languages, Prentice Hall International, 1987.
Author information
Authors and Affiliations
Editor information
Rights 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