From Regular Expressions to DFA's Using Compressed NFA's
نویسندگان
چکیده
There are two principal methods for turning regular expressions into NFA’s one due to McNaughton and Yamada and another due to Thompson. Unfortunately, both have drawbacks. Given a regular expression R of length r and with s occurrences of alphabet symbols, Chang and Paige (1992) and Briiggemamr-Klein (1993) gave O(m + r) time and O(r) space algorithms to produce a O(m) space representation of McNaughton and Yamada’s NFA with s + 1 states and m transitions. The problem with this NFA is that m = O(.?) in the worst case. Thompson’s method takes O(r) time and space to construct a O(r) space NFA with O(r) states and O(r) transitions. The problem with this NFA is that r can be arbitrarily larger than s. We overcome drawbacks of both methods with a O(r) time O(s) space algorithm to construct an O(s) space representation of McNaughton and Yamada’s NFA. Given any set V of NFA states, our representation can be used to compute the set U of states one transition away from the states in V in optimal time 0( 1 V I+ 1 U I). McNaughton and Yamada’s NFA requires O( 1 VI x I UI) time in the worst case. Using Thompson’s NFA, the equivalent calculation requires O(r) time in the worst case. Comparative benchmarks show that an implementation of our method outperforms implementations of competing methods with respect to time for NFA construction, NFA accepting testing, and NFA-to-DFA conversion by subset construction. Throughout this paper program transformations are used to design algorithms and derive programs. A transformation of special importance is a form of finite differencing used previously by Douglas Smith to improve the efficiency of functional programs. * Corresponding author. E-mail: [email protected]. ’ This research was partially supported by Office of Naval Research Grant No. N00014-93-1-0924, Air Force Office of Scientific Research Grant No. AFOSR-91-0308, and National Science Foundation grant MIP9300210. An earlier version of this paper appeared in the Conference Record of the Third Symposium on Combinatorial Pattern Matching (1992). 0304-3975/97/$17.00 @ 1997 -Elsevier Science B.V. All rights reserved PI1 SO304-3975(96)00140-5 2 C-H. Chaq, R. Paiyel Theoretical Computer Science 178 (1997) l-36
منابع مشابه
New Theoretical and Computational Results For RegularLanguages
We show how to turn a regular expression into an O(s) space representation of McNaughton and Yamada's NFA, where s is the number of NFA states. The standard adjacency list representation of McNaughton and Yamada's NFA takes up s+s 2 space in the worst case. The adjacency list representation of the NFA produced by Thompson takes up between 2r and 5r space, where r s in general, and can be arbitr...
متن کاملMinimizing NFA's and Regular Expressions
We show inapproximability results concerning minimization of nondeterministic finite automata (nfa’s) as well as regular expressions relative to given nfa’s, regular expressions or deterministic finite automata (dfa’s). We show that it is impossible to efficiently minimize a given nfa or regular expression with n states, transitions, resp. symbols within the factor o(n), unless P = PSPACE. Our ...
متن کاملCompressed membership problems revisited
Membership problems for compressed strings in regular languages are investigated. Strings are represented by straight-line programs, i.e. contextfree grammars that generate exactly one string. For the representation of regular languages, various formalisms with different degrees of succinctness (e.g. suitably extended regular expressions, hierarchical automata) are considered. Precise complexit...
متن کاملCompressed Membership Problems for Regular Expressions and Hierarchical Automata
Membership problems for compressed strings in regular languages are investigated. Strings are represented by straight-line programs, i.e., context-free grammars that generate exactly one string. For the representation of regular languages, various formalisms with different degrees of succinctness (e.g., suitably extended regular expressions, hierarchical automata) are considered. Precise comple...
متن کاملLearning Minimal Separating DFA's for Compositional Veri cation
Algorithms for learning a minimal separating DFA of two disjoint regular languages have been proposed and adapted for di erent applications. One of the most important applications is learning minimal contextual assumptions in automated compositional veri cation. We propose in this paper an e cient learning algorithm, called L , that learns and generates a minimal separating DFA. Our algorithm h...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
دوره شماره
صفحات -
تاریخ انتشار 1992