Skip to content

PHP Library for Regular Expression to DFA transformation.

License

Notifications You must be signed in to change notification settings

makadev/php-re2dfa

Repository files navigation

CI Testing

php-re2dfa

PHP Library for Regular Expression to DFA transformation.

What it is

A Library for transforming Regular Expressions (RegEx) into Nondeterministic Finitie Automaton with ɛ-transitions (ɛ-NFA) and Deterministic Finitie Automaton (DFA) with named final states for the purpose of analyzing and further use the constructed DFA / ɛ-NFA for example in visualizations or to build tokenizer.

What it's not

  • PCRE compatible
  • a fast Regular Expression matching alternative

Features

  • RegEx to ɛ-NFA transformation
  • direct ɛ-NFA construction
  • transform multiple ɛ-NFA with separate finitie states into a DFA
  • ɛ-NFA simulation
  • DFA simulation

planned Features

  • DFA minimization (f.e. Moore's partition algorithm)
  • DFA and ɛ-NFA output (f.e. dot, json, text)

internal TODOs

  • add usage examples for the features
  • optimizations here and there
  • replace stack oriented RegExParser with AST
    • character classes like whitespace (like :whitespace:)
    • repetition expression (like RE{min,max}, RE{exact})

About

PHP Library for Regular Expression to DFA transformation.

Resources

License

Stars

Watchers

Forks

Packages

No packages published