Package icyllis.arc3d.compiler.lex
Class NFAtoDFA
java.lang.Object
icyllis.arc3d.compiler.lex.NFAtoDFA
Converts a nondeterministic finite automaton to a deterministic finite automaton. Since NFAs and
DFAs differ only in that an NFA allows multiple states at the same time, we can find each
possible combination of simultaneous NFA states and give this combination a label. These labelled
nodes are our DFA nodes, since we can only be in one such unique set of NFA states at a time.
As an NFA can end up in multiple accept states at the same time (for instance, the token "while" is valid for both WHILE and IDENTIFIER), we disambiguate by preferring the first matching regex (in terms of the order in which they were added to the NFA).
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
START_CHAR
public static final char START_CHAR- See Also:
-
END_CHAR
public static final char END_CHAR- See Also:
-
-
Constructor Details
-
NFAtoDFA
-
-
Method Details
-
convert
Returns a DFA created from the NFA.
-