FLAT::Legacy::FA::RE is a regular expression base class.
my $re = RE->new();
my $nfa = $re->to_nfa();
print $nfa->info(); # see stuff on NFA
my $dfa = $nfa->to_dfa();
print $dfa->info(); # see stuff on DFA
my @removed = $dfa->minimize();
print $dfa->info(); # see stuff on minimized DFA
print "Removed ".($#removed+1)." statesn";
This module implements a regular expression parser, and supports the conversion of a RE to a deterministic finite automata. A homegrown recursive descent parser is used to build the parse tree, and the method used to conver the regular expression to a DFA uses no intermediate NFA.
Recursive Descent-safe Regex Grammar:
R -> O
O -> CO'
O' -> '|' CO' | epsilon
C -> SC'
C' -> .SC' | epsilon
S -> LS'
S' -> *S' | epsilon
L -> a | b | c |..| 0 | 1 | 2 |..| (R) | epsilon
Terminal symbols: a,b,c,..,z,0,1,2,..,9,|,*,(,)
NOTE: Concatenation operator, '.', is not a terminal symbol and should not be included in the regex
FAQ: Q: Does this support Perl regular expressions?
A: No, just the regular expression using the terminal symbols listed above.