Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/quinnherden/nfa-to-dfa
A tool to convert Non-deterministic Finite Automata to Deterministic Finite Automata
https://github.com/quinnherden/nfa-to-dfa
automata-theory finite-state-machine
Last synced: 12 days ago
JSON representation
A tool to convert Non-deterministic Finite Automata to Deterministic Finite Automata
- Host: GitHub
- URL: https://github.com/quinnherden/nfa-to-dfa
- Owner: QuinnHerden
- Created: 2022-02-03T17:47:03.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-06T01:43:16.000Z (about 3 years ago)
- Last Synced: 2024-12-08T05:13:16.791Z (2 months ago)
- Topics: automata-theory, finite-state-machine
- Language: Python
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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.1. Define the NFA via a CLI
- When invoking the program, provide a name for the output file
- ```> python3 convert.py ```
- After walking you through the NFA definition, it will create a DFA in the form of .fa2. Define the NFA via an input file
- When invoking the program, provide an input file of type .nfa
- ```> python3 convert.py .nfa```
- This will create a DFA in the form of .fa
## Formatting a .nfa fileThe input .nfa should be formatted as follows:
1. The first line holds a set of one or more states the NFA could initially be on, delimted by spaces.
2. The second line holds a set of zero or more states that the NFA will accept, delimited by spaces.
3. 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 spaces) will define the set of all states the automata will transition into.###### example.nfa
```
1 2
31 a 1
1 b 22 a 2 3
2 b 23 a 3
3 b 2 3
```