Translation of a regular expression into an nfa is fast and


Translation of a regular expression into an NFA is fast and simple. Creation of an equivalent DFA is slower and can lead to a much larger automaton. An interesting alternative is to scan using NFAs, thus obviating the need to ever build a DFA. The idea is to mimic the operation of the CLOSE and MAKEDETERMINISTIC routines (as defined in Section 3.7.2) while scanning. A set of possible states, rather than a single current state, is maintained. As characters are read, transitions from each state in the current set are followed, thereby creating a new set of states. If any state in the current set is final, the characters read will comprise a valid token. Define a suitable encoding for an NFA (perhaps a generalization of the transition table used for DFAs) and write a scanner driver that can use this encoding by following the set-of-states approach outlined previously. This approach to scanning will surely be slower than the standard approach, which uses DFAs. Under what circumstances is scanning using NFAs attractive?

Request for Solution File

Ask an Expert for Answer!!
Basic Statistics: Translation of a regular expression into an nfa is fast and
Reference No:- TGS01474619

Expected delivery within 24 Hours