An open API service indexing awesome lists of open source software.

https://github.com/yanhuijessica/finite-automata-machine

Regex -> ε-NFA -> DFA -> minDFA, lexical analysis
https://github.com/yanhuijessica/finite-automata-machine

dfa dfa-minimization finite-automata-machine mindfa nfa nfa-to-dfa-conversion nfa2dfa python regex

Last synced: 6 months ago
JSON representation

Regex -> ε-NFA -> DFA -> minDFA, lexical analysis

Awesome Lists containing this project

README

          

## Finite-Automata-Machine

### Overview

This is a python program to construct ε-NFA, DFA, and minimised DFA from a given regex. After constructing DFA, it can judge a given word whether it matches the regex.

### Requirements

- Python 3
- python-graphviz

#### Install

```bash
git clone https://github.com/YanhuiJessica/Finite-Automata-Machine.git
cd Finite-Automata-Machine/
pip3 install -r requirements.txt
python3 lexical_analysis.py
```

### Regex -> NFA

- `Regex2NFA.basicstruct`

![basic struct](img/basic.jpg)
- `Regex2NFA.linestruct`

![line struct](img/line.jpg)
- `Regex2NFA.dotstruct`

![dot struct](img/dot.jpg)
- `Regex2NFA.starstruct`

![star struct](img/star.jpg)

### Sample Generation

- Sample regex: `1*0(0|1)*`
- Sample-generated NFA:

![Sample-generated NFA](img/sample-nfa.png)
- Sample-generated DFA:

![Sample-generated DFA](img/sample-dfa.png)
- Sample-generated minDFA:

![Sample-generated minDFA](img/sample-mindfa.png)