Update of /cvsroot/perl-flat/blokhead/dev-scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7074/dev-scripts
Modified Files:
bloktest.pl
Log Message:
DFA complement, intersection (still needs work)
NFA extend alphabet
Index: bloktest.pl
===================================================================
RCS file: /cvsroot/perl-flat/blokhead/dev-scripts/bloktest.pl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** bloktest.pl 24 Feb 2006 01:04:52 -0000 1.7
--- bloktest.pl 1 Mar 2006 18:29:22 -0000 1.8
***************
*** 10,36 ****
sub foo {
! FLAT::Regex->new(shift)->as_nfa;
! }
!
!
! for (qw{ ab|cd|[] ab* []* (a|b)* ([]|[])* }, "#*", "###") {
! my $nfa = foo($_);
!
! print "$_ is: ";
! print $nfa->is_finite ? "finite, " : "infinite, ";
! print $nfa->is_empty ? "empty, " : "nonempty, ";
! print "alphabet = ", $nfa->alphabet, "\n";
}
- #######
! my $nfa = foo("ab(c|d)*e");
! for (qw[ abe abce abcdcdcdcde bcde be abcd ab ]) {
! printf "$_ in the language? %s\n",
! $nfa->contains($_) ? "yes!" : "no";
! my @t = $nfa->trace($_);
! print "[@$_] " for @t;
! print $/;
! }
--- 10,21 ----
sub foo {
! FLAT::Regex->new(shift)->as_min_dfa;
}
! my $dfa1 = foo("((a+b)(a+b))*");
! my $dfa2 = foo("a*");
! my $result = $dfa1->intersect($dfa2);
! print $result->as_graphviz;
|