Regular Expression (Regex), Nondeterministic finite automaton (NFA) and Deterministic finite automaton (DFA) implement in PHP. - Keywords: php php-library regex nfa dfa dfa-regex formal-languages https://github.com/KendallHopkins/FormalTheory

Kendall Hopkins 81f8957ee5 Remove extra newline %!s(int64=12) %!d(string=hai) anos
lib 81f8957ee5 Remove extra newline %!s(int64=12) %!d(string=hai) anos
test 8506a6e0ea Improve optimizer. %!s(int64=12) %!d(string=hai) anos
.travis.yml a98db5ab34 Change default support to UTF-8. %!s(int64=12) %!d(string=hai) anos
LICENSE 116c833aab Add LICENSE file. %!s(int64=12) %!d(string=hai) anos
README.md 25fa26a92a Implement FA reverse. %!s(int64=12) %!d(string=hai) anos
composer.json 9a3ff9f6fd Use correct name format. %!s(int64=12) %!d(string=hai) anos
phpunit.xml.dist eb20655eeb Add unit tests. %!s(int64=13) %!d(string=hai) anos

README.md

FormalTheory

FormalTheory is a library that allows for manipulation and conversion of NFAs, DFAs and Regular Expressions. Some of the features it includes are:

  • Regex Lexing (AST)
  • Regex to NFA conversion
  • NFA to DFA conversion (determinize)
  • DFA minimization
  • DFA solution counting
  • FA equality
  • FA superset/subset test
  • FA proper superset/subset test
  • FA has a valid solution
  • FA print
  • FA export as DOT
  • FA string matching
  • FA intersections
  • FA unions
  • FA negation
  • FA reverse
  • FA to Regex conversion (basic)
  • Heavy Unit Test Coverage
  • Modern Autoloading Support
  • Regex optimization via rules

Note: FA is either a DFA or NFA

Coming Soon™

  • Regex optimization via mutations
  • Generalized DFA solving based on positive/negative match list

Build Status