This paper presents a Boyer-Moore type algorithm for regular grammar pattern matching, answering a variant of an open problem posed by A.V. Aho in 1980 [2, p. 342]. The new algorithm handles patterns specified by regular (left linear) grammars -- a generalization of the Boyer-Moore (single keyword) and Commentz-Walter (multiple keyword) algorithms, both considered extensively in [17] and [14, Chapter 4]. Like the Boyer-Moore and Commentz-Walter algorithms, the new algorithm makes use of shift functions which can be precomputed and tabulated. The precomputation functions are derived, and it is shown that they can be precomputed from Commentz-Walter's d1 and d2 shift functions. In most cases, the Boyer-Moore (respectively Commentz-Walter) algorithm has greatly outperformed the Knuth-Morris-Pratt (respectively Aho-Corasick) algorithm (as discussed in [14, Chapter 13]). In testing, an earlier version of the algorithm presented in this paper also frequently outperforms the regular grammar generalization of the Aho-Corasick algorithm.
CITATION STYLE
Watson, B. W. (1996). A new regular grammar pattern matching algorithm. In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 1136, pp. 364–377). Springer Verlag. https://doi.org/10.1007/3-540-61680-2_68
Mendeley helps you to discover research relevant for your work.