Affiliation:
1. BRICS, University of Aarhus, Aarhus N, Denmark
Abstract
We show how to obtain all of Knuth, Morris, and Pratt's linear-time string matcher by specializing a quadratic-time string matcher with respect to a pattern string. Although it has been known for fifteen years how to obtain this linear matcher by partial evaluation of a quadratic one, how to obtain it
in linear time
has remained an open problem.Obtaining a linear matcher by the partial evaluation of a quadratic one is achieved by performing its backtracking at specialization time and memoizing its results. We show (1) how to rewrite the source matcher such that its static intermediate computations can be shared at specialization time and (2) how to extend the memoization capabilities of a partial evaluator to static functions. Such an extended partial evaluator, if its memoization is implemented efficiently, specializes the rewritten source matcher in linear time. Finally, we show that the method also applies to a variant of Boyer and Moore's string matcher.
Publisher
Association for Computing Machinery (ACM)
Reference41 articles.
1. On obtaining Knuth, Morris, and Pratt's string matcher by partial evaluation
2. Aho A. V. Hopcroft J. E. and Ullman J. D. 1974. The Design and Analysis of Computer Algorithms. Addison Wesley Reading Mass.]] Aho A. V. Hopcroft J. E. and Ullman J. D. 1974. The Design and Analysis of Computer Algorithms. Addison Wesley Reading Mass.]]
3. Specialization of lazy functional logic programs
4. Amtoft T. 1993. Sharing of computations. Ph.D. thesis DAIMI Department of Computer Science University of Aarhus Aarhus Denmark. Tech. rep. PB-453.]] Amtoft T. 1993. Sharing of computations. Ph.D. thesis DAIMI Department of Computer Science University of Aarhus Aarhus Denmark. Tech. rep. PB-453.]]
5. The abstraction and instantiation of string-matching programs. In The Essence of Computation: Complexity, Analysis, Transformation. Essays Dedicated to Neil D. Jones, T. æ. Mogensen et al., eds;Amtoft T.;LNCS,2002
Cited by
8 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. String Matching Algorithm Using Multi-Characters Inverted Lists;WSEAS TRANSACTIONS ON COMPUTERS;2023-10-03
2. Maximally-Polyvariant Partial Evaluation in Polynomial Time;Lecture Notes in Computer Science;2016
3. The Essence of Multi-stage Evaluation in LMS;A List of Successes That Can Change the World;2016
4. A Type Theoretic Specification of Partial Evaluation;Proceedings of the 16th International Symposium on Principles and Practice of Declarative Programming - PPDP '14;2014
5. Bibliography;Program Specialization;2013-02-05