From: <per...@li...> - 2006-02-24 15:41:17
|
Update of /cvsroot/perl-flat/blokhead/lib/FLAT In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4925/lib/FLAT Modified Files: NFA.pm PFA.pm Log Message: moving forward in reverse on this PFA.pm thing :) Index: NFA.pm =================================================================== RCS file: /cvsroot/perl-flat/blokhead/lib/FLAT/NFA.pm,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NFA.pm 24 Feb 2006 06:49:42 -0000 1.8 --- NFA.pm 24 Feb 2006 15:41:02 -0000 1.9 *************** *** 232,236 **** } ! sub _SET_ID { join "\0", sort { $a <=> $b } @_; } sub as_dfa { my $self = shift; --- 232,236 ---- } ! sub _SET_ID { join "\0", sort { $a <=> $b } @_; } # could this be encapsulated as inside of a closure or anonymous function? sub as_dfa { my $self = shift; Index: PFA.pm =================================================================== RCS file: /cvsroot/perl-flat/blokhead/lib/FLAT/PFA.pm,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** PFA.pm 24 Feb 2006 06:49:42 -0000 1.1 --- PFA.pm 24 Feb 2006 15:41:02 -0000 1.2 *************** *** 1,5 **** ! package FLAT::PFA; use strict; ! use base 'FLAT::FA'; use FLAT::Transition; --- 1,5 ---- ! package FLAT::PFA; # should this be FLAT::NFA::PFA ? .. might be too confusing use strict; ! use base 'FLAT::NFA'; use FLAT::Transition; *************** *** 7,55 **** sub new { my $pkg = shift; ! my $self = $pkg->SUPER::new(@_); ! $self->{TRANS_CLASS} = "FLAT::Transition"; return $self; } ! sub singleton { ! my ($class, $char) = @_; ! my $nfa = $class->new; ! ! if (not defined $char) { ! $nfa->add_states(1); ! $nfa->set_starting(0); ! } elsif ($char eq "") { ! $nfa->add_states(1); ! $nfa->set_starting(0); ! $nfa->set_accepting(0); ! } else { ! $nfa->add_states(2); ! $nfa->set_starting(0); ! $nfa->set_accepting(1); ! $nfa->set_transition(0, 1, $char); ! } ! return $nfa; ! } ! sub as_pfa { - } sub as_nfa { } ! sub union { ! ! } ! ! sub concat { ! ! } ! ! sub kleene { ! ! } ! sub shuffle { --- 7,29 ---- sub new { my $pkg = shift; ! my $self = $pkg->SUPER::new(@_); # Inherits constructor from NFA ! # contains states (actually nodes), alphabet, and ! # transitions like NFA ! $self->{TIED} = []; # tracks tied nodes ! $self->{ACTIVE_NODES} = []; # tracks active nodes - could be label like start and final return $self; } ! # Uses FLAT::NFA methods for fall back, including: union, concat, kleene, and singleton ! sub as_pfa { $_[0]->clone() } + # PFA->NFA conversion algorithm sub as_nfa { } ! # Shuffle constructor sub shuffle { *************** *** 89,92 **** --- 63,70 ---- =over + item $pfa-E<gt>shuffle + + Cloning method; returns a copy of itself. + =item $pfa-E<gt>shuffle |