/regex-to-nfa

A python tool for Regex conversion to nondeterministic finite automaton (NFA)

Primary LanguagePython

Regular Expression to Epsilon NFA

A python tool for Regex conversion to nondeterministic finite automaton (NFA).


Language Used:


About:

This repo contains the 🐍 code for converting a valid Regular Expression to its equivalent Epsilon-NFA.

The code is divided into these major parts:

  1. NFA CONSTRUCTION
  2. NFA TRANSITION TABLE
  3. NFA VISUALIZATION

How to use:

Make sure you have Graphviz installed in your system and added to System PATH.

and for necessary Python Libraries, simply run:

pip install -r requirements.txt

Now open terminal(in the same folder) and run:

python convert.py "REGEX"

replace the REGEX with the actual Regular Expression you want to generate the table and graph for.

NOTE: No guarantee that the code works for all types of regular expressions, but works for most of them.


example usage:






Any suggestions, improvements, and feedback is welcome.