Flutter Engine
The Flutter Engine
|
#include <NFAtoDFA.h>
Public Member Functions | |
NFAtoDFA (NFA *nfa) | |
DFA | convert () |
Static Public Attributes | |
static constexpr char | START_CHAR = 9 |
static constexpr char | END_CHAR = 126 |
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).
Definition at line 32 of file NFAtoDFA.h.
|
inline |
Definition at line 37 of file NFAtoDFA.h.
|
inline |
Returns a DFA created from the NFA.
Definition at line 43 of file NFAtoDFA.h.
|
inlinestaticconstexpr |
Definition at line 35 of file NFAtoDFA.h.
|
inlinestaticconstexpr |
Definition at line 34 of file NFAtoDFA.h.