From: notifies s. of c. c. <per...@li...> - 2006-09-26 13:23:04
|
Revision: 71 http://svn.sourceforge.net/perl-flat/?rev=71&view=rev Author: estrabd Date: 2006-09-26 06:22:54 -0700 (Tue, 26 Sep 2006) Log Message: ----------- added some psuedo code to PFA.pm for the PFA->NFA conversion; updated TODO Modified Paths: -------------- trunk/perl-flat/TODO trunk/perl-flat/dev-scripts/pregex-to-pfa.pl trunk/perl-flat/lib/FLAT/PFA.pm Modified: trunk/perl-flat/TODO =================================================================== --- trunk/perl-flat/TODO 2006-09-12 14:37:09 UTC (rev 70) +++ trunk/perl-flat/TODO 2006-09-26 13:22:54 UTC (rev 71) @@ -7,3 +7,7 @@ keep track of where in the code we assume ->get_states are numbers (if we want to add state label support back). + +input and output options and formats + + Modified: trunk/perl-flat/dev-scripts/pregex-to-pfa.pl =================================================================== --- trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-09-12 14:37:09 UTC (rev 70) +++ trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-09-26 13:22:54 UTC (rev 71) @@ -3,7 +3,6 @@ use lib qw(../lib); use FLAT::Regex::WithExtraOps; -use Data::Dumper; use FLAT::PFA; # This is mainly my test script for FLAT::FA::PFA.pm @@ -24,4 +23,3 @@ close $fh; my $NFA = $PFA->as_nfa(); -print Dumper($NFA); Modified: trunk/perl-flat/lib/FLAT/PFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/PFA.pm 2006-09-12 14:37:09 UTC (rev 70) +++ trunk/perl-flat/lib/FLAT/PFA.pm 2006-09-26 13:22:54 UTC (rev 71) @@ -61,7 +61,7 @@ } # will implement the joining of two PFAs with lambda transitions -# need to fix +# need to fix <-- still broken? need to check!! sub shuffle { my @pfas = map { $_->as_pfa } @_; my $result = $pfas[0]->clone; @@ -170,6 +170,33 @@ # stretching my legs after a few months being gone ... see if the legacy conversion # can be modified to work +# See FLAT::Legacy::PFA for the initialization stuff - I am sure it can be refined a lot! +# PSUEDO CODE +# my @Dstates = get_starting(); +# while (@Dstates) +# { my @T = @{pop (@Dstates)}; !!remember that states are made up of 1 or more nodes +# my $current = $self->serialize_name(@T) +# add $current (or @T) to @DONE stack +# foreach my $symbol ($self->alphabet) +# { if ($symbol eq $LAMBDA) +# { foreach my $L ($self->get_tied_from($current)) +# { foreach my $U ($self->move($L,$LAMBDA) push(@N,unique($U)); } +# } +# else +# { foreach my $t (@T) +# { foreach my $U ($self->move($U,$symbol)) +# { push(@N,$self->complement(@T,$t)) }; +# } +# } +# Ndtran [N,$symbol] := N !!add new transition +# if N unmarked, add N to Dstates +# } +# } + +#1. make sure psuedo code is correct +#2. implement it, including any require initializations +#3. refine, refactor + sub as_nfa { my $self = shift; my @Dstates = $self->get_states(); @@ -177,14 +204,6 @@ # New NFA object reference my $result = FLAT::NFA->new(); - print Dumper(@Dstates); - -# while (@Dstates) { -# foreach ($self->alphabet()) { - -# } -# } - return $result; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |