nfa-to-dfa
This tool converts a Nondeterministic Finite Automata (NFA) into a Deterministic Finite Automata (DFA)
Using convert.py
You may provide an input NFA in one of two ways.
-
Define the NFA via a CLI
- When invoking the program, provide a name for the output file
> python convert.py
- After walking you through the NFA definition, it will create a DFA in the form of .fa
- When invoking the program, provide a name for the output file
-
Define the NFA via an input file
- When invoking the program, provide an input file of type .nfa
> python convert.py
.nfa
- This will create a DFA in the form of .fa
- When invoking the program, provide an input file of type .nfa
Formatting a .nfa file
The input .nfa should be formatted as follows:
- The first line holds a set of states the NFA could initially be on, enclosed in curly braces, delimted by commas
- The second line holds a set of states that the NFA will accept, enclosed in curly braces, delimted by commas
- The following lines will define the state transitions, as a tuple, for each state you wish to define.
- The first symbol is the current state.
- The second symbol will be the transition symbol.
- The following symbol (or symbols, delimted by space) will define the set of all states the automata will transition into.
example.nfa
{1}
{1, 3}
1 a 2 3
1 b 1
2 a 3
2 b 1
3 a 3
3 b 3