/Regex2MDFA

Input a Regex, get its AST, NFA, DFA and finally it Minimized DFA (Compiler Course Assignment)

Primary LanguageJupyter Notebook

Regex2MDFA

Input a Regex, get its abstract syntax tree (AST), non-deterministic finite automata (NFA), deterministic finite automata (DFA) and finally its Minimized DFA

⚒️ Supported Rules

  • Alteration: A|B
  • Concatenation: AB
  • 1 or More: A+
  • 0 or More: A*
  • Optional - 0 or 1: A?
  • ORing: [abc], (a|b|c), [123], (1|2|3)
  • Ranges: [0-9] or [a-z]
  • Grouping using parentheses to control the order of operations (ABD)+
  • Min and Max Number of repetitions of certain token (a{1,3}) and its different vairiants

🏁 Get started

  • Using the main.py file
git clone https://github.com/BigFish2086/Regex2MDFA
cd Regex2MDFA
python -m pip install -r requirements.txt
cd src
python ./main.py <REGEX>
  • Or using the notebook provided here in the github link, however whenever changing the testcase/regex in hand, make sure to re-run the whole notebook again, since it's just a compilation of all the files in the src folder