From regular expressions to deterministic automata
Theoretical Computer Science
A Four Russians algorithm for regular expression pattern matching
Journal of the ACM (JACM)
Partial derivatives of regular expressions and finite automaton constructions
Theoretical Computer Science
On the use of regular expressions for searching text
ACM Transactions on Programming Languages and Systems (TOPLAS)
Programming Techniques: Regular expression search algorithm
Communications of the ACM
The Design and Analysis of Computer Algorithms
The Design and Analysis of Computer Algorithms
Hi-index | 0.00 |
The problem of converting a regular expression to NFA is a fundamental problem that has been well studied. However, the two basic construction algorithms: (1) Thompson, (2) McNaughton-Yamada and Glushkov, does not yield the best solution in terms of the number of states and transitions. In this paper, we show: For a regular expression with l literals, we can construct an NFA with 2l states and 4l transitions in the worst case. Our algorithm runs in linear time with respect to the length of the regular expression. This improves the construction algorithm given by Chang in [5], which constructs an NFA with 5l=2 states and (10l -- 5)/2 transitions in the worst case. The method presented here is much simpler and easier to understand, as we use only naive ideas: divide and conquer.