You can subscribe to this list here.
2006 |
Jan
|
Feb
(32) |
Mar
(25) |
Apr
(13) |
May
(3) |
Jun
|
Jul
|
Aug
(1) |
Sep
(5) |
Oct
(2) |
Nov
|
Dec
(1) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(28) |
Mar
(6) |
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: notifies s. of c. c. <per...@li...> - 2007-02-16 22:06:15
|
Revision: 95 http://svn.sourceforge.net/perl-flat/?rev=95&view=rev Author: estrabd Date: 2007-02-16 14:06:13 -0800 (Fri, 16 Feb 2007) Log Message: ----------- found bug in FA->predecessors, but not sure what it really is; need to test FA::as_directed, etc Modified Paths: -------------- trunk/perl-flat/dev-scripts/bdetest.pl trunk/perl-flat/lib/FLAT/FA.pm trunk/perl-flat/lib/FLAT/NFA.pm trunk/perl-flat/lib/FLAT.pm Modified: trunk/perl-flat/dev-scripts/bdetest.pl =================================================================== --- trunk/perl-flat/dev-scripts/bdetest.pl 2007-02-16 19:59:22 UTC (rev 94) +++ trunk/perl-flat/dev-scripts/bdetest.pl 2007-02-16 22:06:13 UTC (rev 95) @@ -4,4 +4,4 @@ use lib qw(../lib); use FLAT::Regex::WithExtraOps; -print FLAT::Regex->new('a')->as_nfa->as_dfa->as_min_dfa->as_undirected; +print FLAT::Regex->new($ARGV[0])->as_nfa->as_dfa->as_min_dfa->trim_sinks->as_undirected; Modified: trunk/perl-flat/lib/FLAT/FA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/FA.pm 2007-02-16 19:59:22 UTC (rev 94) +++ trunk/perl-flat/lib/FLAT/FA.pm 2007-02-16 22:06:13 UTC (rev 95) @@ -205,7 +205,9 @@ } sub predecessors { - shift->clone->reverse->successors(@_); + my $self = shift; + #$self->clone->reverse->successors(@_); + $self->clone->successors(@_); } # reverse - no change from NFA Modified: trunk/perl-flat/lib/FLAT/NFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/NFA.pm 2007-02-16 19:59:22 UTC (rev 94) +++ trunk/perl-flat/lib/FLAT/NFA.pm 2007-02-16 22:06:13 UTC (rev 95) @@ -211,24 +211,25 @@ # This format is just a undirected graph - so transition and state info is lost sub as_undirected { - my $self = shift; - my @symbols = $self->alphabet(); - my @states = $self->get_states(); - my @lines = (); - foreach (@states) { - my $s = $_; - my @conns = (); - foreach (@symbols) { - my $a = $_; - # foreach state, get all nodes connected to it; ignore symbols and - # treat transitions simply as directed - push(@conns,$self->successors($s,$a)); - push(@conns,$self->predecessors($s,$a)); #<-- something terribly wrong is going on here - } - @conns = $self->array_unique(@conns); - push(@lines,sprintf("%s (%s) %s",$s,($#conns+1),join(' ',@conns))); - } - return sprintf("%s\n%s",($#states+1),join("\n",@lines)); + return "This function is not implemented yet because of weird problem..."; +# my $self = shift; +# my @symbols = $self->alphabet(); +# my @states = $self->get_states(); +# my @lines = (); +# foreach (@states) { +# my $s = $_; +# my @conns = (); +# foreach (@symbols) { +# my $a = $_; +# # foreach state, get all nodes connected to it; ignore symbols and +# # treat transitions simply as directed +# push(@conns,$self->successors($s,$a)); +# push(@conns,$self->predecessors($s,$a)); #<-- something terribly wrong is going on here +# } +# @conns = $self->array_unique(@conns); +# push(@lines,sprintf("%s (%s) %s",$s,($#conns+1),join(' ',@conns))); +# } +# return sprintf("%s\n%s",($#states+1),join("\n",@lines)); } # Format that Dr. Sukhamay KUNDU likes to use in his assignments :) Modified: trunk/perl-flat/lib/FLAT.pm =================================================================== --- trunk/perl-flat/lib/FLAT.pm 2007-02-16 19:59:22 UTC (rev 94) +++ trunk/perl-flat/lib/FLAT.pm 2007-02-16 22:06:13 UTC (rev 95) @@ -107,17 +107,17 @@ COMMANDS: %perl -MFLAT -e - "compare 're1','re2'" # comares 2 regexs | see note [2] - "dump 're1'" # dumps parse trees | see note[1] + "compare 're1','re2'" # comares 2 regexs | see note [2] + "dump 're1'" # dumps parse trees | see note[1] "dfa2gv 're1'" # dumps graphviz graph desc | see note[1] "nfa2gv 're1'" # dumps graphviz graph desc | see note[1] "pfa2gv 're1'" # dumps graphviz graph desc | see note[1] - dfa2directed - nfa2directed - pfa2directed - dfa2undirected - nfa2undirected - pfa2undirected + dfa2directed # dumps directed graph without transitions + nfa2directed # dumps directed graph without transitions + pfa2directed # dumps directed graph without transitions + dfa2undirected #broken # dumps undirected graph without transitions + nfa2undirected #broken # dumps undirected graph without transitions + pfa2undirected #broken # dumps undirected graph without transitions random_pre random_re help @@ -244,6 +244,136 @@ } } +# dumps directed graph using Kundu notation +# Usage: +# perl -MFLAT -e "dfa2directed('a&b&c&d*e*')" +sub dfa2directed { + shift; + use FLAT::Regex::WithExtraOps; + use FLAT::DFA; + use FLAT::NFA; + use FLAT::PFA; + # trims sink states from min-dfa since transitions are gone + if (@_) + { foreach (@_) + { my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa()->as_dfa->as_min_dfa->trim_sinks(); + print $FA->as_directed;} } + else + { while (<STDIN>) + { chomp; + my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa()->as_dfa->as_min_dfa->trim_sinks(); + print $FA->as_directed;} + } + print "\n"; +} + +# dumps directed graph using Kundu notation +# Usage: +# perl -MFLAT -e "nfa2directed('a&b&c&d*e*')" +sub nfa2directed { + shift; + use FLAT::Regex::WithExtraOps; + use FLAT::DFA; + use FLAT::NFA; + use FLAT::PFA; + if (@_) + { foreach (@_) + { my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa(); + print $FA->as_directed;} } + else + { while (<STDIN>) + { chomp; + my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa(); + print $FA->as_directed;} + } + print "\n"; +} + +# dumps directed graph using Kundu notation +# Usage: +# perl -MFLAT -e "pfa2directed('a&b&c&d*e*')" +sub pfa2directed { + shift; + use FLAT::Regex::WithExtraOps; + use FLAT::PFA; + if (@_) + { foreach (@_) + { my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa(); + print $FA->as_directed;} } + else + { while (<STDIN>) + { chomp; + my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa(); + print $FA->as_directed;} + } + print "\n"; +} + +# dumps undirected graph using Kundu notation +# Usage: +# perl -MFLAT -e "dfa2undirected('a&b&c&d*e*')" +sub dfa2undirected { + shift; + use FLAT::Regex::WithExtraOps; + use FLAT::DFA; + use FLAT::NFA; + use FLAT::PFA; + # trims sink states from min-dfa since transitions are gone + if (@_) + { foreach (@_) + { my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa()->as_dfa->as_min_dfa->trim_sinks(); + print $FA->as_undirected;} } + else + { while (<STDIN>) + { chomp; + my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa()->as_dfa->as_min_dfa->trim_sinks(); + print $FA->as_undirected;} + } + print "\n"; +} + +# dumps undirected graph using Kundu notation +# Usage: +# perl -MFLAT -e "nfa2undirected('a&b&c&d*e*')" +sub nfa2undirected { + shift; + use FLAT::Regex::WithExtraOps; + use FLAT::DFA; + use FLAT::NFA; + use FLAT::PFA; + if (@_) + { foreach (@_) + { my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa(); + print $FA->as_undirected;} } + else + { while (<STDIN>) + { chomp; + my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa(); + print $FA->as_undirected;} + } + print "\n"; +} + +# dumps undirected graph using Kundu notation +# Usage: +# perl -MFLAT -e "pfa2undirected('a&b&c&d*e*')" +sub pfa2undirected { + shift; + use FLAT::Regex::WithExtraOps; + use FLAT::PFA; + if (@_) + { foreach (@_) + { my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa(); + print $FA->as_undirected;} } + else + { while (<STDIN>) + { chomp; + my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa(); + print $FA->as_undirected;} + } + print "\n"; +} + # compares 2 give PREs # Usage: # perl -MFLAT -e "compare('a','a&b&c&d*e*')" #<-- no match, btw This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2007-02-16 19:59:25
|
Revision: 94 http://svn.sourceforge.net/perl-flat/?rev=94&view=rev Author: estrabd Date: 2007-02-16 11:59:22 -0800 (Fri, 16 Feb 2007) Log Message: ----------- committing, but think I found a weird bug Modified Paths: -------------- trunk/perl-flat/dev-scripts/bdetest.pl trunk/perl-flat/lib/FLAT/NFA.pm trunk/perl-flat/lib/FLAT.pm Modified: trunk/perl-flat/dev-scripts/bdetest.pl =================================================================== --- trunk/perl-flat/dev-scripts/bdetest.pl 2007-02-15 17:54:42 UTC (rev 93) +++ trunk/perl-flat/dev-scripts/bdetest.pl 2007-02-16 19:59:22 UTC (rev 94) @@ -2,8 +2,6 @@ use strict; use lib qw(../lib); -use FLAT::Regex::Transform; -use Data::Dumper; +use FLAT::Regex::WithExtraOps; -my $trans = FLAT::Regex::Transform->new('abc&efg+hi'); -print Dumper($trans); +print FLAT::Regex->new('a')->as_nfa->as_dfa->as_min_dfa->as_undirected; Modified: trunk/perl-flat/lib/FLAT/NFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/NFA.pm 2007-02-15 17:54:42 UTC (rev 93) +++ trunk/perl-flat/lib/FLAT/NFA.pm 2007-02-16 19:59:22 UTC (rev 94) @@ -207,7 +207,54 @@ ############ Formatted output +# Format that Dr. Sukhamay KUNDU likes to use in his assignments :) +# This format is just a undirected graph - so transition and state info is lost +sub as_undirected { + my $self = shift; + my @symbols = $self->alphabet(); + my @states = $self->get_states(); + my @lines = (); + foreach (@states) { + my $s = $_; + my @conns = (); + foreach (@symbols) { + my $a = $_; + # foreach state, get all nodes connected to it; ignore symbols and + # treat transitions simply as directed + push(@conns,$self->successors($s,$a)); + push(@conns,$self->predecessors($s,$a)); #<-- something terribly wrong is going on here + } + @conns = $self->array_unique(@conns); + push(@lines,sprintf("%s (%s) %s",$s,($#conns+1),join(' ',@conns))); + } + return sprintf("%s\n%s",($#states+1),join("\n",@lines)); +} + +# Format that Dr. Sukhamay KUNDU likes to use in his assignments :) +# This format is just a directed graph - so transition and state info is lost + +sub as_directed { + my $self = shift; + my @symbols = $self->alphabet(); + my @states = $self->get_states(); + my @lines = (); + foreach (@states) { + my $s = $_; + my @conns = (); + foreach (@symbols) { + my $a = $_; + # foreach state, get all nodes connected to it; ignore symbols and + # treat transitions simply as directed + push(@conns,$self->successors($s,$a)); + } + @conns = $self->array_unique(@conns); + push(@lines,sprintf("%s (%s) %s",$s,($#conns+1),join(' ',@conns))); + } + return sprintf("%s\n%s",($#states+1),join("\n",@lines)); +} + + # Graph Description Language, aiSee, etc sub as_gdl { my $self = shift; Modified: trunk/perl-flat/lib/FLAT.pm =================================================================== --- trunk/perl-flat/lib/FLAT.pm 2007-02-15 17:54:42 UTC (rev 93) +++ trunk/perl-flat/lib/FLAT.pm 2007-02-16 19:59:22 UTC (rev 94) @@ -64,9 +64,12 @@ @EXPORT = qw(compare dump - dfa2dot - nfa2dot - pfa2dot + dfa2gv + nfa2gv + pfa2gv + dfa2directed + nfa2directed + pfa2directed random_pre random_re help @@ -106,9 +109,15 @@ %perl -MFLAT -e "compare 're1','re2'" # comares 2 regexs | see note [2] "dump 're1'" # dumps parse trees | see note[1] - "dfa2dot 're1'" # dumps graphviz graph desc | see note[1] - "nfa2dot 're1'" # dumps graphviz graph desc | see note[1] - "pfa2dot 're1'" # dumps graphviz graph desc | see note[1] + "dfa2gv 're1'" # dumps graphviz graph desc | see note[1] + "nfa2gv 're1'" # dumps graphviz graph desc | see note[1] + "pfa2gv 're1'" # dumps graphviz graph desc | see note[1] + dfa2directed + nfa2directed + pfa2directed + dfa2undirected + nfa2undirected + pfa2undirected random_pre random_re help @@ -176,8 +185,8 @@ # dumps graphviz notation # Usage: -# perl -MFLAT -e "dfa2dot('a&b&c&d*e*')" -sub dfa2dot { +# perl -MFLAT -e "dfa2gv('a&b&c&d*e*')" +sub dfa2gv { shift; use FLAT::Regex::WithExtraOps; use FLAT::DFA; @@ -197,8 +206,8 @@ # dumps graphviz notation # Usage: -# perl -MFLAT -e "nfa2dot('a&b&c&d*e*')" -sub nfa2dot { +# perl -MFLAT -e "nfa2gv('a&b&c&d*e*')" +sub nfa2gv { shift; use FLAT::Regex::WithExtraOps; use FLAT::DFA; @@ -218,8 +227,8 @@ # dumps graphviz notation # Usage: -# perl -MFLAT -e "pfa2dot('a&b&c&d*e*')" -sub pfa2dot { +# perl -MFLAT -e "pfa2gv('a&b&c&d*e*')" +sub pfa2gv { shift; use FLAT::Regex::WithExtraOps; use FLAT::PFA; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2007-02-15 17:54:41
|
Revision: 93 http://svn.sourceforge.net/perl-flat/?rev=93&view=rev Author: estrabd Date: 2007-02-15 09:54:42 -0800 (Thu, 15 Feb 2007) Log Message: ----------- ... Modified Paths: -------------- trunk/perl-flat/bin/fash Modified: trunk/perl-flat/bin/fash =================================================================== --- trunk/perl-flat/bin/fash 2007-02-15 17:53:10 UTC (rev 92) +++ trunk/perl-flat/bin/fash 2007-02-15 17:54:42 UTC (rev 93) @@ -3,3 +3,6 @@ use strict; use warnings; +print <<END +This is a stub for the soon to come finite-automata-shell interface for doing stupid regex tricks via CPAN. +END This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2007-02-15 17:53:12
|
Revision: 92 http://svn.sourceforge.net/perl-flat/?rev=92&view=rev Author: estrabd Date: 2007-02-15 09:53:10 -0800 (Thu, 15 Feb 2007) Log Message: ----------- added /usr/bin/local/fash utility stub and added ExtUtils::MakeMaker run script to install it Modified Paths: -------------- trunk/perl-flat/MANIFEST trunk/perl-flat/Makefile.PL trunk/perl-flat/lib/FLAT/Symbol.pm Added Paths: ----------- trunk/perl-flat/bin/ trunk/perl-flat/bin/fash trunk/perl-flat/bin/util-put.pl Modified: trunk/perl-flat/MANIFEST =================================================================== --- trunk/perl-flat/MANIFEST 2007-02-15 05:56:19 UTC (rev 91) +++ trunk/perl-flat/MANIFEST 2007-02-15 17:53:10 UTC (rev 92) @@ -14,5 +14,7 @@ lib/FLAT/DFA.pm lib/FLAT/Transition.pm lib/FLAT.pm +bin/util-put.pl +bin/fash Makefile.PL META.yml Module meta-data (added by MakeMaker) Modified: trunk/perl-flat/Makefile.PL =================================================================== --- trunk/perl-flat/Makefile.PL 2007-02-15 05:56:19 UTC (rev 91) +++ trunk/perl-flat/Makefile.PL 2007-02-15 17:53:10 UTC (rev 92) @@ -6,6 +6,7 @@ NAME => 'FLAT', VERSION_FROM => 'lib/FLAT.pm', PREREQ_PM => { Parse::RecDescent => 0 }, + PL_FILES => {'bin/util-put.pl', 'bin/util-put'}, ($] >= 5.005 ? (ABSTRACT_FROM => 'lib/FLAT.pm', AUTHOR => 'perl-flat') : ()), Added: trunk/perl-flat/bin/fash =================================================================== --- trunk/perl-flat/bin/fash (rev 0) +++ trunk/perl-flat/bin/fash 2007-02-15 17:53:10 UTC (rev 92) @@ -0,0 +1,5 @@ +#!/usr/bin/env perl + +use strict; +use warnings; + Added: trunk/perl-flat/bin/util-put.pl =================================================================== --- trunk/perl-flat/bin/util-put.pl (rev 0) +++ trunk/perl-flat/bin/util-put.pl 2007-02-15 17:53:10 UTC (rev 92) @@ -0,0 +1,18 @@ +#! perl + +use strict; +use warnings; +use Config; +use File::Copy; + +# copys bin/f@sh to system bin directory and ensures its is 755 + +if (-w $Config{installbin}) + { print "Installing f\@sh utility in $Config{installbin}\n"; + copy('bin/fash',"$Config{installbin}/fash") || die $!; + chmod 0755,"$Config{installbin}/fash";} +else + { print "You do not have permission to write to $Config{installbin}\n"; + print "Warn: bin/f\@sh not installed to $Config{installbin}\n";} + +1; Modified: trunk/perl-flat/lib/FLAT/Symbol.pm =================================================================== --- trunk/perl-flat/lib/FLAT/Symbol.pm 2007-02-15 05:56:19 UTC (rev 91) +++ trunk/perl-flat/lib/FLAT/Symbol.pm 2007-02-15 17:53:10 UTC (rev 92) @@ -81,5 +81,3 @@ A super class that is intended to provide a simple mechanism for storing a symbol that might be in conflict with another symbol in string form. TYPE is used to distinguish. Currenly this neither this, nor its current sub classes, Regular and Special, are used. - -=back This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2007-02-15 05:56:18
|
Revision: 91 http://svn.sourceforge.net/perl-flat/?rev=91&view=rev Author: estrabd Date: 2007-02-14 21:56:19 -0800 (Wed, 14 Feb 2007) Log Message: ----------- updated the help section Modified Paths: -------------- trunk/perl-flat/lib/FLAT.pm Modified: trunk/perl-flat/lib/FLAT.pm =================================================================== --- trunk/perl-flat/lib/FLAT.pm 2007-02-15 05:45:35 UTC (rev 90) +++ trunk/perl-flat/lib/FLAT.pm 2007-02-15 05:56:19 UTC (rev 91) @@ -129,9 +129,17 @@ against a regular expression, a concrete example will be provided. TO DO: - "getstrings 're1' [opts...]" # given regex, pump strings based on options - "variations 're1' [opts...]" # given regex will provide equivalents +1 Implement "getstrings 're1' [opts...]" # given regex, pump strings + based on options + +2 Implement "variations 're1' [opts...]" # given regex will provide + equivalents +3 Allow random_pre and random_re to accept the number of regexes, the + number of characters, and the character set; eventually it might be + useful to allow modification of the chances of the different operators + occuring... + CREDITS: Blockhead, CPAN.pm (for the example of how to implement these one liners), and #perl on irc.freenode.net for pointing out something I missed when This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2007-02-15 05:45:37
|
Revision: 90 http://svn.sourceforge.net/perl-flat/?rev=90&view=rev Author: estrabd Date: 2007-02-14 21:45:35 -0800 (Wed, 14 Feb 2007) Log Message: ----------- pimped out the one liner interface! Modified Paths: -------------- trunk/perl-flat/lib/FLAT.pm trunk/perl-flat/t/03-pregex-pfa.t Modified: trunk/perl-flat/lib/FLAT.pm =================================================================== --- trunk/perl-flat/lib/FLAT.pm 2007-02-14 22:53:19 UTC (rev 89) +++ trunk/perl-flat/lib/FLAT.pm 2007-02-15 05:45:35 UTC (rev 90) @@ -89,30 +89,81 @@ sub help { print <<END +__________ .__ ___________.____ ___________ +\______ \ ___________| | \_ _____/| | _____\__ ___/ + | ___// __ \_ __ \ | | __) | | \__ \ | | + | | \ ___/| | \/ |__ | \ | |___ / __ \| | + |____| \___ >__| |____/ \___ / |_______ (____ /____| + \/ \/ \/ \/ + + NB: Everything is wrt parallel regular expressions, i.e., + NB: with the addtional shuffle operator, "&". All this + NB: means is that you can use the ambersand (&) as a symbol + NB: in the regular expressions you submit because it will be + NB: detected as an operator. + +COMMANDS: %perl -MFLAT -e - "compare 're1','re2'" - "dump 're1'" - "dfa2dot 're1'" - "nfa2dot 're1'" - "pfa2dot 're1'" - random_pre - random_re - help - To Do: - "getstrings 're1' [opts...]" # given regex, pump strings based on options - "variations 're1' [opts...]" # given regex will provide equivalents + "compare 're1','re2'" # comares 2 regexs | see note [2] + "dump 're1'" # dumps parse trees | see note[1] + "dfa2dot 're1'" # dumps graphviz graph desc | see note[1] + "nfa2dot 're1'" # dumps graphviz graph desc | see note[1] + "pfa2dot 're1'" # dumps graphviz graph desc | see note[1] + random_pre + random_re + help + +NOTES: +[1] This means you could presumably do something like the following: + %perl -MFLAT -e command < text_file_with_1_regex_per_line.txt + ^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +[2] This command compares the minimal DFAs of each regular expression; + if there exists a exact 1-1 mapping of symbols, states, and + transitions then the DFAs are considered equal. This means that + "abc" will be equal to "def" To make matters more confusing, "ab+ac" + would be equivalent to "xy+xz"; or worse yet, "z(x+y)". So to the + 'compare' command, "ab+ac" == "xy+xz" == "z(x+y)". This however + does not translate into the situation where "ab+ac" will accept + the same LITERAL strings as "z(x+y)" because the symbols are obviously + different. Once we implement the "test" command, used to test strings + against a regular expression, a concrete example will be provided. + +TO DO: + "getstrings 're1' [opts...]" # given regex, pump strings based on options + "variations 're1' [opts...]" # given regex will provide equivalents + +CREDITS: +Blockhead, CPAN.pm (for the example of how to implement these one liners), +and #perl on irc.freenode.net for pointing out something I missed when +trying to copy CPAN's majik. + +Perl FLAT and all included modules are released under the same terms as Perl +itself. Cheers. + +SEE: +http://perl-flat.sourceforge.net + END } # dumps parse tree # Usage: -# perl -MFLAT -e "dump('a&b&c&d*e*')" +# perl -MFLAT -e "dump('re1','re2',...,'reN')" +# perl -MFLAT -e dump < list_of_regexes.dat sub dump { shift; use FLAT::Regex::WithExtraOps; use Data::Dumper; - my $PRE = FLAT::Regex::WithExtraOps->new(shift); - print Dumper($PRE); + if (@_) + { foreach (@_) + { my $PRE = FLAT::Regex::WithExtraOps->new($_); + print Dumper($PRE); }} + else + { while (<STDIN>) + { chomp; + my $PRE = FLAT::Regex::WithExtraOps->new($_); + print Dumper($PRE); } + } } # dumps graphviz notation @@ -124,8 +175,16 @@ use FLAT::DFA; use FLAT::NFA; use FLAT::PFA; - my $DFA1 = FLAT::Regex::WithExtraOps->new(shift)->as_pfa()->as_nfa()->as_dfa->as_min_dfa(); - print $DFA1->as_graphviz; + if (@_) + { foreach (@_) + { my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa()->as_dfa->as_min_dfa(); + print $FA->as_graphviz;} } + else + { while (<STDIN>) + { chomp; + my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa()->as_dfa->as_min_dfa(); + print $FA->as_graphviz;} + } } # dumps graphviz notation @@ -137,8 +196,16 @@ use FLAT::DFA; use FLAT::NFA; use FLAT::PFA; - my $NFA1 = FLAT::Regex::WithExtraOps->new(shift)->as_pfa()->as_nfa(); - print $NFA1->as_graphviz; + if (@_) + { foreach (@_) + { my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa(); + print $FA->as_graphviz;} } + else + { while (<STDIN>) + { chomp; + my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa()->as_nfa(); + print $FA->as_graphviz;} + } } # dumps graphviz notation @@ -148,8 +215,16 @@ shift; use FLAT::Regex::WithExtraOps; use FLAT::PFA; - my $PFA1 = FLAT::Regex::WithExtraOps->new(shift)->as_pfa(); - print $PFA1->as_graphviz; + if (@_) + { foreach (@_) + { my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa(); + print $FA->as_graphviz;} } + else + { while (<STDIN>) + { chomp; + my $FA = FLAT::Regex::WithExtraOps->new($_)->as_pfa(); + print $FA->as_graphviz;} + } } # compares 2 give PREs @@ -176,18 +251,21 @@ # perl -MFLAT -e random_pre sub random_pre { shift; + my $and_chance = shift; # skirt around deep recursion warning annoyance local $SIG{__WARN__} = sub { $_[0] =~ /^Deep recursion/ or warn $_[0] }; srand $$; my %CMDLINEOPTS = (); # Percent chance of each operator occuring $CMDLINEOPTS{LENGTH} = 32; - $CMDLINEOPTS{AND} = 10; $CMDLINEOPTS{OR} = 6; $CMDLINEOPTS{STAR} = 10; $CMDLINEOPTS{OPEN} = 5; $CMDLINEOPTS{CLOSE} = 0; $CMDLINEOPTS{n} = 1; + $CMDLINEOPTS{AND} = 10; #<-- default + $CMDLINEOPTS{AND} = $and_chance if ($and_chance == 0); #<-- to make it just an re (no shuffle) + my $getRandomChar = sub { my $ch = ''; @@ -233,58 +311,7 @@ # Usage: # perl -MFLAT -e random_re sub random_re { - shift; - # skirt around deep recursion warning annoyance - local $SIG{__WARN__} = sub { $_[0] =~ /^Deep recursion/ or warn $_[0] }; - srand $$; - my %CMDLINEOPTS = (); - # Percent chance of each operator occuring - $CMDLINEOPTS{LENGTH} = 32; - $CMDLINEOPTS{AND} = 0; #<-- turns off & operator - $CMDLINEOPTS{OR} = 6; - $CMDLINEOPTS{STAR} = 10; - $CMDLINEOPTS{OPEN} = 5; - $CMDLINEOPTS{CLOSE} = 0; - $CMDLINEOPTS{n} = 1; - - my $getRandomChar = sub { - my $ch = ''; - # Get a random character between 0 and 127. - do { - $ch = int(rand 2); - } while ($ch !~ m/[a-zA-Z0-9]/); - return $ch; - }; - - my $getRandomRE = sub { - my $str = ''; - my @closeparens = (); - for (1..$CMDLINEOPTS{LENGTH}) { - $str .= $getRandomChar->(); - # % chance of an "or" - if (int(rand 100) < $CMDLINEOPTS{OR}) { - $str .= "|1"; - } elsif (int(rand 100) < $CMDLINEOPTS{AND}) { - $str .= "&0"; - } elsif (int(rand 100) < $CMDLINEOPTS{STAR}) { - $str .= "*1"; - } elsif (int(rand 100) < $CMDLINEOPTS{OPEN}) { - $str .= "("; - push(@closeparens,'0101)'); - } elsif (int(rand 100) < $CMDLINEOPTS{CLOSE} && @closeparens) { - $str .= pop(@closeparens); - } - } - # empty out @closeparens if there are still some left - if (@closeparens) { - $str .= join('',@closeparens); - } - return $str; - }; - - for (1..$CMDLINEOPTS{n}) { - print $getRandomRE->(),"\n"; - } + shift->random_pre(0); } 1; Modified: trunk/perl-flat/t/03-pregex-pfa.t =================================================================== --- trunk/perl-flat/t/03-pregex-pfa.t 2007-02-14 22:53:19 UTC (rev 89) +++ trunk/perl-flat/t/03-pregex-pfa.t 2007-02-15 05:45:35 UTC (rev 90) @@ -8,6 +8,7 @@ use FLAT::NFA; use FLAT::PFA; use FLAT::Regex::WithExtraOps; +use Memoize; diag("This test might take a while.."); @@ -20,14 +21,9 @@ is( ($DFA1->equals($DFA2)), 1 ); -<<<<<<< .mine -__END__ #<-- comment out if you wish to conduct the time consuming tests -_ # w&w* -======= diag("w&v*.."); # w&v* ->>>>>>> .r86 $PFA1 = FLAT::Regex::WithExtraOps->new('abc&(def)*')->as_pfa(); $PFA2 = FLAT::Regex::WithExtraOps->new('(def)*( a(bc&(def)*)+ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2007-02-14 22:53:19
|
Revision: 89 http://svn.sourceforge.net/perl-flat/?rev=89&view=rev Author: estrabd Date: 2007-02-14 14:53:19 -0800 (Wed, 14 Feb 2007) Log Message: ----------- tet Modified Paths: -------------- trunk/perl-flat/lib/FLAT.pm Modified: trunk/perl-flat/lib/FLAT.pm =================================================================== --- trunk/perl-flat/lib/FLAT.pm 2007-02-14 16:01:27 UTC (rev 88) +++ trunk/perl-flat/lib/FLAT.pm 2007-02-14 22:53:19 UTC (rev 89) @@ -122,7 +122,9 @@ shift; use FLAT::Regex::WithExtraOps; use FLAT::DFA; - my $DFA1 = FLAT::Regex::WithExtraOps->new(shift)->as_nfa()->as_dfa->as_min_dfa(); + use FLAT::NFA; + use FLAT::PFA; + my $DFA1 = FLAT::Regex::WithExtraOps->new(shift)->as_pfa()->as_nfa()->as_dfa->as_min_dfa(); print $DFA1->as_graphviz; } @@ -132,8 +134,10 @@ sub nfa2dot { shift; use FLAT::Regex::WithExtraOps; + use FLAT::DFA; use FLAT::NFA; - my $NFA1 = FLAT::Regex::WithExtraOps->new(shift)->as_nfa(); + use FLAT::PFA; + my $NFA1 = FLAT::Regex::WithExtraOps->new(shift)->as_pfa()->as_nfa(); print $NFA1->as_graphviz; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2007-02-14 16:01:57
|
Revision: 88 http://svn.sourceforge.net/perl-flat/?rev=88&view=rev Author: estrabd Date: 2007-02-14 08:01:27 -0800 (Wed, 14 Feb 2007) Log Message: ----------- one liners looking good! Modified Paths: -------------- trunk/perl-flat/lib/FLAT.pm Modified: trunk/perl-flat/lib/FLAT.pm =================================================================== --- trunk/perl-flat/lib/FLAT.pm 2007-02-14 06:37:25 UTC (rev 87) +++ trunk/perl-flat/lib/FLAT.pm 2007-02-14 16:01:27 UTC (rev 88) @@ -58,9 +58,8 @@ } } -# Support for perl one liners - like what CPAN.pm uses -use Exporter (); -@ISA = 'Exporter'; +# Support for perl one liners - like what CPAN.pm uses #<- should move all to another file +use base 'Exporter'; #instead of: use Exporter (); @ISA = 'Exporter'; use vars qw(@EXPORT $AUTOLOAD); @EXPORT = qw(compare @@ -69,7 +68,8 @@ nfa2dot pfa2dot random_pre - random_re + random_re + help ); # Todo: validate, test (string against re), validate (re), @@ -87,6 +87,23 @@ package FLAT::OneLiners; +sub help { +print <<END +%perl -MFLAT -e + "compare 're1','re2'" + "dump 're1'" + "dfa2dot 're1'" + "nfa2dot 're1'" + "pfa2dot 're1'" + random_pre + random_re + help + To Do: + "getstrings 're1' [opts...]" # given regex, pump strings based on options + "variations 're1' [opts...]" # given regex will provide equivalents +END +} + # dumps parse tree # Usage: # perl -MFLAT -e "dump('a&b&c&d*e*')" @@ -135,7 +152,7 @@ # Usage: # perl -MFLAT -e "compare('a','a&b&c&d*e*')" #<-- no match, btw sub compare { - shift; + shift; use FLAT::Regex::WithExtraOps; use FLAT::DFA; use FLAT::PFA; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2007-02-14 06:37:24
|
Revision: 87 http://svn.sourceforge.net/perl-flat/?rev=87&view=rev Author: estrabd Date: 2007-02-13 22:37:25 -0800 (Tue, 13 Feb 2007) Log Message: ----------- added preliminary support for one liners such as: perl -MFLAT "pfa2dot('a&b&c') | dot -Tpng > test.png" Modified Paths: -------------- trunk/perl-flat/MANIFEST trunk/perl-flat/lib/FLAT.pm trunk/perl-flat/t/03-pregex-pfa.t Added Paths: ----------- trunk/perl-flat/lib/FLAT/Regex/Transform/ trunk/perl-flat/t/04-transform.t Modified: trunk/perl-flat/MANIFEST =================================================================== --- trunk/perl-flat/MANIFEST 2007-02-13 15:20:36 UTC (rev 86) +++ trunk/perl-flat/MANIFEST 2007-02-14 06:37:25 UTC (rev 87) @@ -1,9 +1,13 @@ t/01-regex.t +t/02-fa.t +t/03/pregex-pfa.t +t/04-transform.t MANIFEST lib/FLAT/Regex/Op.pm lib/FLAT/Regex/Parser.pm lib/FLAT/Regex/Transform.pm lib/FLAT/Regex/WithNegations.pm +lib/FLAT/Regex/Transform.pm lib/FLAT/Regex.pm lib/FLAT/FA.pm lib/FLAT/NFA.pm Modified: trunk/perl-flat/lib/FLAT.pm =================================================================== --- trunk/perl-flat/lib/FLAT.pm 2007-02-13 15:20:36 UTC (rev 86) +++ trunk/perl-flat/lib/FLAT.pm 2007-02-14 06:37:25 UTC (rev 87) @@ -58,6 +58,214 @@ } } +# Support for perl one liners - like what CPAN.pm uses +use Exporter (); +@ISA = 'Exporter'; +use vars qw(@EXPORT $AUTOLOAD); + +@EXPORT = qw(compare + dump + dfa2dot + nfa2dot + pfa2dot + random_pre + random_re + ); + +# Todo: validate, test (string against re), validate (re), +# alternate (give re, list some alternates), getstrings (gen strings give re) + +sub AUTOLOAD { + my($l) = $AUTOLOAD; + $l =~ s/.*:://; + my(%EXPORT); + @EXPORT{@EXPORT} = ''; + if (exists $EXPORT{$l}){ + FLAT::OneLiners->$l(@_); + } +} + +package FLAT::OneLiners; + +# dumps parse tree +# Usage: +# perl -MFLAT -e "dump('a&b&c&d*e*')" +sub dump { + shift; + use FLAT::Regex::WithExtraOps; + use Data::Dumper; + my $PRE = FLAT::Regex::WithExtraOps->new(shift); + print Dumper($PRE); +} + +# dumps graphviz notation +# Usage: +# perl -MFLAT -e "dfa2dot('a&b&c&d*e*')" +sub dfa2dot { + shift; + use FLAT::Regex::WithExtraOps; + use FLAT::DFA; + my $DFA1 = FLAT::Regex::WithExtraOps->new(shift)->as_nfa()->as_dfa->as_min_dfa(); + print $DFA1->as_graphviz; +} + +# dumps graphviz notation +# Usage: +# perl -MFLAT -e "nfa2dot('a&b&c&d*e*')" +sub nfa2dot { + shift; + use FLAT::Regex::WithExtraOps; + use FLAT::NFA; + my $NFA1 = FLAT::Regex::WithExtraOps->new(shift)->as_nfa(); + print $NFA1->as_graphviz; +} + +# dumps graphviz notation +# Usage: +# perl -MFLAT -e "pfa2dot('a&b&c&d*e*')" +sub pfa2dot { + shift; + use FLAT::Regex::WithExtraOps; + use FLAT::PFA; + my $PFA1 = FLAT::Regex::WithExtraOps->new(shift)->as_pfa(); + print $PFA1->as_graphviz; +} + +# compares 2 give PREs +# Usage: +# perl -MFLAT -e "compare('a','a&b&c&d*e*')" #<-- no match, btw +sub compare { + shift; + use FLAT::Regex::WithExtraOps; + use FLAT::DFA; + use FLAT::PFA; + my $PFA1 = FLAT::Regex::WithExtraOps->new(shift)->as_pfa(); + my $PFA2 = FLAT::Regex::WithExtraOps->new(shift)->as_pfa(); + my $DFA1 = $PFA1->as_nfa->as_min_dfa; + my $DFA2 = $PFA2->as_nfa->as_min_dfa; + if ($DFA1->equals($DFA2)) { + print "Yes\n"; + } else { + print "No\n"; + } +} + +# prints random PRE +# Usage: +# perl -MFLAT -e random_pre +sub random_pre { + shift; + # skirt around deep recursion warning annoyance + local $SIG{__WARN__} = sub { $_[0] =~ /^Deep recursion/ or warn $_[0] }; + srand $$; + my %CMDLINEOPTS = (); + # Percent chance of each operator occuring + $CMDLINEOPTS{LENGTH} = 32; + $CMDLINEOPTS{AND} = 10; + $CMDLINEOPTS{OR} = 6; + $CMDLINEOPTS{STAR} = 10; + $CMDLINEOPTS{OPEN} = 5; + $CMDLINEOPTS{CLOSE} = 0; + $CMDLINEOPTS{n} = 1; + + my $getRandomChar = sub { + my $ch = ''; + # Get a random character between 0 and 127. + do { + $ch = int(rand 2); + } while ($ch !~ m/[a-zA-Z0-9]/); + return $ch; + }; + + my $getRandomRE = sub { + my $str = ''; + my @closeparens = (); + for (1..$CMDLINEOPTS{LENGTH}) { + $str .= $getRandomChar->(); + # % chance of an "or" + if (int(rand 100) < $CMDLINEOPTS{OR}) { + $str .= "|1"; + } elsif (int(rand 100) < $CMDLINEOPTS{AND}) { + $str .= "&0"; + } elsif (int(rand 100) < $CMDLINEOPTS{STAR}) { + $str .= "*1"; + } elsif (int(rand 100) < $CMDLINEOPTS{OPEN}) { + $str .= "("; + push(@closeparens,'0101)'); + } elsif (int(rand 100) < $CMDLINEOPTS{CLOSE} && @closeparens) { + $str .= pop(@closeparens); + } + } + # empty out @closeparens if there are still some left + if (@closeparens) { + $str .= join('',@closeparens); + } + return $str; + }; + + for (1..$CMDLINEOPTS{n}) { + print $getRandomRE->(),"\n"; + } +} + +# prints random RE (no & operator) +# Usage: +# perl -MFLAT -e random_re +sub random_re { + shift; + # skirt around deep recursion warning annoyance + local $SIG{__WARN__} = sub { $_[0] =~ /^Deep recursion/ or warn $_[0] }; + srand $$; + my %CMDLINEOPTS = (); + # Percent chance of each operator occuring + $CMDLINEOPTS{LENGTH} = 32; + $CMDLINEOPTS{AND} = 0; #<-- turns off & operator + $CMDLINEOPTS{OR} = 6; + $CMDLINEOPTS{STAR} = 10; + $CMDLINEOPTS{OPEN} = 5; + $CMDLINEOPTS{CLOSE} = 0; + $CMDLINEOPTS{n} = 1; + + my $getRandomChar = sub { + my $ch = ''; + # Get a random character between 0 and 127. + do { + $ch = int(rand 2); + } while ($ch !~ m/[a-zA-Z0-9]/); + return $ch; + }; + + my $getRandomRE = sub { + my $str = ''; + my @closeparens = (); + for (1..$CMDLINEOPTS{LENGTH}) { + $str .= $getRandomChar->(); + # % chance of an "or" + if (int(rand 100) < $CMDLINEOPTS{OR}) { + $str .= "|1"; + } elsif (int(rand 100) < $CMDLINEOPTS{AND}) { + $str .= "&0"; + } elsif (int(rand 100) < $CMDLINEOPTS{STAR}) { + $str .= "*1"; + } elsif (int(rand 100) < $CMDLINEOPTS{OPEN}) { + $str .= "("; + push(@closeparens,'0101)'); + } elsif (int(rand 100) < $CMDLINEOPTS{CLOSE} && @closeparens) { + $str .= pop(@closeparens); + } + } + # empty out @closeparens if there are still some left + if (@closeparens) { + $str .= join('',@closeparens); + } + return $str; + }; + + for (1..$CMDLINEOPTS{n}) { + print $getRandomRE->(),"\n"; + } +} + 1; __END__ Modified: trunk/perl-flat/t/03-pregex-pfa.t =================================================================== --- trunk/perl-flat/t/03-pregex-pfa.t 2007-02-13 15:20:36 UTC (rev 86) +++ trunk/perl-flat/t/03-pregex-pfa.t 2007-02-14 06:37:25 UTC (rev 87) @@ -9,7 +9,7 @@ use FLAT::PFA; use FLAT::Regex::WithExtraOps; -diag("This test will take a while.."); +diag("This test might take a while.."); diag("w&v.."); # w&w @@ -20,8 +20,14 @@ is( ($DFA1->equals($DFA2)), 1 ); +<<<<<<< .mine +__END__ #<-- comment out if you wish to conduct the time consuming tests +_ +# w&w* +======= diag("w&v*.."); # w&v* +>>>>>>> .r86 $PFA1 = FLAT::Regex::WithExtraOps->new('abc&(def)*')->as_pfa(); $PFA2 = FLAT::Regex::WithExtraOps->new('(def)*( a(bc&(def)*)+ Added: trunk/perl-flat/t/04-transform.t =================================================================== --- trunk/perl-flat/t/04-transform.t (rev 0) +++ trunk/perl-flat/t/04-transform.t 2007-02-14 06:37:25 UTC (rev 87) @@ -0,0 +1,19 @@ +use Test::More 'no_plan'; + +use strict; + +use lib qw(../lib); +use FLAT; + +is (1,1); + +SKIP: +{ eval{ require Math::Symbolic::Transform } + # will contain tests for FLAT::Regex::Transform if + # Math::Symbolic::Transform is installed, if not + # no worries - we don't want Math::Symbolic::Transform + # to become a pre-requisite for FLAT in general. + # -- Begin tests below -- # +} + +__END__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2007-02-13 15:22:08
|
Revision: 86 http://svn.sourceforge.net/perl-flat/?rev=86&view=rev Author: estrabd Date: 2007-02-13 07:20:36 -0800 (Tue, 13 Feb 2007) Log Message: ----------- getting ready for transform Modified Paths: -------------- trunk/perl-flat/MANIFEST trunk/perl-flat/dev-scripts/bdetest.pl Added Paths: ----------- trunk/perl-flat/lib/FLAT/Regex/Transform.pm Modified: trunk/perl-flat/MANIFEST =================================================================== --- trunk/perl-flat/MANIFEST 2007-02-09 17:17:25 UTC (rev 85) +++ trunk/perl-flat/MANIFEST 2007-02-13 15:20:36 UTC (rev 86) @@ -2,6 +2,7 @@ MANIFEST lib/FLAT/Regex/Op.pm lib/FLAT/Regex/Parser.pm +lib/FLAT/Regex/Transform.pm lib/FLAT/Regex/WithNegations.pm lib/FLAT/Regex.pm lib/FLAT/FA.pm Modified: trunk/perl-flat/dev-scripts/bdetest.pl =================================================================== --- trunk/perl-flat/dev-scripts/bdetest.pl 2007-02-09 17:17:25 UTC (rev 85) +++ trunk/perl-flat/dev-scripts/bdetest.pl 2007-02-13 15:20:36 UTC (rev 86) @@ -2,28 +2,8 @@ use strict; use lib qw(../lib); -use FLAT; -use FLAT::NFA; -use FLAT::PFA; -use FLAT::Regex::WithExtraOps; +use FLAT::Regex::Transform; use Data::Dumper; -# This is mainly my test script for FLAT::FA::PFA.pm - -#my $DFA = FLAT::Regex->new('ab+ba')->as_nfa->as_min_dfa; -#print $DFA->as_gdl; - -my $PFA1 = FLAT::Regex::WithExtraOps->new('(abc)*dx&(efg)*hy')->as_pfa(); #<--! -my $PFA2 = FLAT::Regex::WithExtraOps->new('(abc+efg)*( - dx&(efg)*hy+ - hy&(abc)*dx+ - a(((bca)*bcdx)&((efg)*hy))+ - a(((bca)*)&((efg)*hy))bcdx+ - e(((fge)*fghy)&((abc)*dx))+ - e(((fge)*)&((abc)*dx))fghy - )')->as_pfa(); - -my $DFA1 = $PFA1->as_nfa->as_min_dfa; -my $DFA2 = $PFA2->as_nfa->as_min_dfa; - -print $DFA1->equals($DFA2); +my $trans = FLAT::Regex::Transform->new('abc&efg+hi'); +print Dumper($trans); Added: trunk/perl-flat/lib/FLAT/Regex/Transform.pm =================================================================== --- trunk/perl-flat/lib/FLAT/Regex/Transform.pm (rev 0) +++ trunk/perl-flat/lib/FLAT/Regex/Transform.pm 2007-02-13 15:20:36 UTC (rev 86) @@ -0,0 +1,18 @@ +package FLAT::Regex::Transform; + +# Extends FLAT::Regex::WithExtraOps with PRegex transformations +# (i.e., reductions based on: w*v & a*b + +use base 'FLAT::Regex::WithExtraOps'; + +sub new { + my $pkg = shift; + my $self = $pkg->SUPER::new(@_); + return $self; +} + +# Ideally, the transformation should be implemented as an iterator. This +# approach will be finite for shuffles with NO closed strings, but will carry on +# indefinitely for the shuffle of strings where at least one of the strings is closed + +1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2007-02-09 17:25:14
|
Revision: 85 http://svn.sourceforge.net/perl-flat/?rev=85&view=rev Author: estrabd Date: 2007-02-09 09:17:25 -0800 (Fri, 09 Feb 2007) Log Message: ----------- cleaned up Removed Paths: ------------- trunk/perl-flat/dev-scripts/dfa.gdl trunk/perl-flat/dev-scripts/dfa.png trunk/perl-flat/dev-scripts/mindfa.gdl trunk/perl-flat/dev-scripts/mindfa.png trunk/perl-flat/dev-scripts/nfa.gdl trunk/perl-flat/dev-scripts/nfa.png trunk/perl-flat/dev-scripts/output.png trunk/perl-flat/dev-scripts/pfa.gdl trunk/perl-flat/dev-scripts/pfa.png Deleted: trunk/perl-flat/dev-scripts/dfa.gdl =================================================================== --- trunk/perl-flat/dev-scripts/dfa.gdl 2007-02-09 17:16:21 UTC (rev 84) +++ trunk/perl-flat/dev-scripts/dfa.gdl 2007-02-09 17:17:25 UTC (rev 85) @@ -1,72 +0,0 @@ -graph: { -display_edge_labels: yes - -node: { title:"0" shape:circle borderstyle: solid} -node: { title:"1" shape:circle borderstyle: solid} -node: { title:"2" shape:circle borderstyle: solid} -node: { title:"3" shape:circle borderstyle: solid} -node: { title:"4" shape:circle borderstyle: solid} -node: { title:"5" shape:circle borderstyle: solid} -node: { title:"6" shape:circle borderstyle: solid} -node: { title:"7" shape:circle borderstyle: solid} -node: { title:"8" shape:circle borderstyle: solid} -node: { title:"9" shape:circle borderstyle: solid} -node: { title:"10" shape:circle borderstyle: solid} -node: { title:"11" shape:circle borderstyle: solid} -node: { title:"12" shape:circle borderstyle: solid} -node: { title:"13" shape:circle borderstyle: solid} -node: { title:"14" shape:circle borderstyle: solid} -node: { title:"15" shape:circle borderstyle: solid} -node: { title:"16" shape:circle borderstyle: double bordercolor: red} - -edge: { source: "0" target: "1" label: "c" arrowstyle: line } -edge: { source: "0" target: "2" label: "a" arrowstyle: line } -edge: { source: "0" target: "3" label: "b" arrowstyle: line } -edge: { source: "0" target: "4" label: "d" arrowstyle: line } -edge: { source: "1" target: "5" label: "c" arrowstyle: line } -edge: { source: "1" target: "6" label: "a" arrowstyle: line } -edge: { source: "1" target: "7" label: "b" arrowstyle: line } -edge: { source: "1" target: "8" label: "d" arrowstyle: line } -edge: { source: "2" target: "5" label: "a" arrowstyle: line } -edge: { source: "2" target: "6" label: "c" arrowstyle: line } -edge: { source: "2" target: "9" label: "b" arrowstyle: line } -edge: { source: "2" target: "10" label: "d" arrowstyle: line } -edge: { source: "3" target: "5" label: "b" arrowstyle: line } -edge: { source: "3" target: "7" label: "c" arrowstyle: line } -edge: { source: "3" target: "9" label: "a" arrowstyle: line } -edge: { source: "3" target: "11" label: "d" arrowstyle: line } -edge: { source: "4" target: "5" label: "d" arrowstyle: line } -edge: { source: "4" target: "8" label: "c" arrowstyle: line } -edge: { source: "4" target: "10" label: "a" arrowstyle: line } -edge: { source: "4" target: "11" label: "b" arrowstyle: line } -edge: { source: "5" target: "5" label: "a,b,c,d" arrowstyle: line } -edge: { source: "6" target: "5" label: "a,c" arrowstyle: line } -edge: { source: "6" target: "12" label: "b" arrowstyle: line } -edge: { source: "6" target: "13" label: "d" arrowstyle: line } -edge: { source: "7" target: "5" label: "b,c" arrowstyle: line } -edge: { source: "7" target: "12" label: "a" arrowstyle: line } -edge: { source: "7" target: "14" label: "d" arrowstyle: line } -edge: { source: "8" target: "5" label: "c,d" arrowstyle: line } -edge: { source: "8" target: "13" label: "a" arrowstyle: line } -edge: { source: "8" target: "14" label: "b" arrowstyle: line } -edge: { source: "9" target: "5" label: "a,b" arrowstyle: line } -edge: { source: "9" target: "12" label: "c" arrowstyle: line } -edge: { source: "9" target: "15" label: "d" arrowstyle: line } -edge: { source: "10" target: "5" label: "a,d" arrowstyle: line } -edge: { source: "10" target: "13" label: "c" arrowstyle: line } -edge: { source: "10" target: "15" label: "b" arrowstyle: line } -edge: { source: "11" target: "5" label: "b,d" arrowstyle: line } -edge: { source: "11" target: "14" label: "c" arrowstyle: line } -edge: { source: "11" target: "15" label: "a" arrowstyle: line } -edge: { source: "12" target: "5" label: "a,b,c" arrowstyle: line } -edge: { source: "12" target: "16" label: "d" arrowstyle: line } -edge: { source: "13" target: "5" label: "a,c,d" arrowstyle: line } -edge: { source: "13" target: "16" label: "b" arrowstyle: line } -edge: { source: "14" target: "5" label: "b,c,d" arrowstyle: line } -edge: { source: "14" target: "16" label: "a" arrowstyle: line } -edge: { source: "15" target: "5" label: "a,b,d" arrowstyle: line } -edge: { source: "15" target: "16" label: "c" arrowstyle: line } -edge: { source: "16" target: "5" label: "a,b,c,d" arrowstyle: line } -} - - Deleted: trunk/perl-flat/dev-scripts/dfa.png =================================================================== (Binary files differ) Deleted: trunk/perl-flat/dev-scripts/mindfa.gdl =================================================================== --- trunk/perl-flat/dev-scripts/mindfa.gdl 2007-02-09 17:16:21 UTC (rev 84) +++ trunk/perl-flat/dev-scripts/mindfa.gdl 2007-02-09 17:17:25 UTC (rev 85) @@ -1,55 +0,0 @@ -graph: { -display_edge_labels: yes - -node: { title:"0" shape:circle borderstyle: solid} -node: { title:"1" shape:circle borderstyle: solid} -node: { title:"2" shape:circle borderstyle: solid} -node: { title:"3" shape:circle borderstyle: solid} -node: { title:"4" shape:circle borderstyle: solid} -node: { title:"5" shape:circle borderstyle: solid} -node: { title:"6" shape:circle borderstyle: solid} -node: { title:"7" shape:circle borderstyle: solid} -node: { title:"8" shape:circle borderstyle: solid} -node: { title:"9" shape:circle borderstyle: solid} -node: { title:"10" shape:circle borderstyle: solid} -node: { title:"11" shape:circle borderstyle: solid} -node: { title:"12" shape:circle borderstyle: solid} -node: { title:"13" shape:circle borderstyle: solid} -node: { title:"14" shape:circle borderstyle: solid} -node: { title:"15" shape:circle borderstyle: double bordercolor: red} - -edge: { source: "0" target: "1" label: "c" arrowstyle: line } -edge: { source: "0" target: "2" label: "a" arrowstyle: line } -edge: { source: "0" target: "3" label: "b" arrowstyle: line } -edge: { source: "0" target: "4" label: "d" arrowstyle: line } -edge: { source: "1" target: "5" label: "a" arrowstyle: line } -edge: { source: "1" target: "6" label: "b" arrowstyle: line } -edge: { source: "1" target: "7" label: "d" arrowstyle: line } -edge: { source: "2" target: "5" label: "c" arrowstyle: line } -edge: { source: "2" target: "8" label: "b" arrowstyle: line } -edge: { source: "2" target: "9" label: "d" arrowstyle: line } -edge: { source: "3" target: "6" label: "c" arrowstyle: line } -edge: { source: "3" target: "8" label: "a" arrowstyle: line } -edge: { source: "3" target: "10" label: "d" arrowstyle: line } -edge: { source: "4" target: "7" label: "c" arrowstyle: line } -edge: { source: "4" target: "9" label: "a" arrowstyle: line } -edge: { source: "4" target: "10" label: "b" arrowstyle: line } -edge: { source: "5" target: "11" label: "b" arrowstyle: line } -edge: { source: "5" target: "12" label: "d" arrowstyle: line } -edge: { source: "6" target: "11" label: "a" arrowstyle: line } -edge: { source: "6" target: "13" label: "d" arrowstyle: line } -edge: { source: "7" target: "12" label: "a" arrowstyle: line } -edge: { source: "7" target: "13" label: "b" arrowstyle: line } -edge: { source: "8" target: "11" label: "c" arrowstyle: line } -edge: { source: "8" target: "14" label: "d" arrowstyle: line } -edge: { source: "9" target: "12" label: "c" arrowstyle: line } -edge: { source: "9" target: "14" label: "b" arrowstyle: line } -edge: { source: "10" target: "13" label: "c" arrowstyle: line } -edge: { source: "10" target: "14" label: "a" arrowstyle: line } -edge: { source: "11" target: "15" label: "d" arrowstyle: line } -edge: { source: "12" target: "15" label: "b" arrowstyle: line } -edge: { source: "13" target: "15" label: "a" arrowstyle: line } -edge: { source: "14" target: "15" label: "c" arrowstyle: line } -} - - Deleted: trunk/perl-flat/dev-scripts/mindfa.png =================================================================== (Binary files differ) Deleted: trunk/perl-flat/dev-scripts/nfa.gdl =================================================================== --- trunk/perl-flat/dev-scripts/nfa.gdl 2007-02-09 17:16:21 UTC (rev 84) +++ trunk/perl-flat/dev-scripts/nfa.gdl 2007-02-09 17:17:25 UTC (rev 85) @@ -1,59 +0,0 @@ -graph: { -display_edge_labels: yes - -node: { title:"0" shape:circle borderstyle: solid} -node: { title:"1" shape:circle borderstyle: solid} -node: { title:"2" shape:circle borderstyle: solid} -node: { title:"3" shape:circle borderstyle: solid} -node: { title:"4" shape:circle borderstyle: solid} -node: { title:"5" shape:circle borderstyle: solid} -node: { title:"6" shape:circle borderstyle: solid} -node: { title:"7" shape:circle borderstyle: solid} -node: { title:"8" shape:circle borderstyle: solid} -node: { title:"9" shape:circle borderstyle: solid} -node: { title:"10" shape:circle borderstyle: solid} -node: { title:"11" shape:circle borderstyle: solid} -node: { title:"12" shape:circle borderstyle: double bordercolor: red} -node: { title:"13" shape:circle borderstyle: solid} -node: { title:"14" shape:circle borderstyle: solid} -node: { title:"15" shape:circle borderstyle: solid} -node: { title:"16" shape:circle borderstyle: solid} -node: { title:"17" shape:circle borderstyle: solid} - -edge: { source: "0" target: "1" label: "epsilon" arrowstyle: line } -edge: { source: "1" target: "2" label: "c" arrowstyle: line } -edge: { source: "1" target: "3" label: "a" arrowstyle: line } -edge: { source: "1" target: "4" label: "b" arrowstyle: line } -edge: { source: "1" target: "5" label: "d" arrowstyle: line } -edge: { source: "2" target: "6" label: "d" arrowstyle: line } -edge: { source: "2" target: "14" label: "b" arrowstyle: line } -edge: { source: "2" target: "17" label: "a" arrowstyle: line } -edge: { source: "3" target: "7" label: "d" arrowstyle: line } -edge: { source: "3" target: "15" label: "b" arrowstyle: line } -edge: { source: "3" target: "17" label: "c" arrowstyle: line } -edge: { source: "4" target: "8" label: "d" arrowstyle: line } -edge: { source: "4" target: "14" label: "c" arrowstyle: line } -edge: { source: "4" target: "15" label: "a" arrowstyle: line } -edge: { source: "5" target: "6" label: "c" arrowstyle: line } -edge: { source: "5" target: "7" label: "a" arrowstyle: line } -edge: { source: "5" target: "8" label: "b" arrowstyle: line } -edge: { source: "6" target: "9" label: "b" arrowstyle: line } -edge: { source: "6" target: "13" label: "a" arrowstyle: line } -edge: { source: "7" target: "10" label: "b" arrowstyle: line } -edge: { source: "7" target: "13" label: "c" arrowstyle: line } -edge: { source: "8" target: "9" label: "c" arrowstyle: line } -edge: { source: "8" target: "10" label: "a" arrowstyle: line } -edge: { source: "9" target: "11" label: "a" arrowstyle: line } -edge: { source: "10" target: "11" label: "c" arrowstyle: line } -edge: { source: "11" target: "12" label: "epsilon" arrowstyle: line } -edge: { source: "13" target: "11" label: "b" arrowstyle: line } -edge: { source: "14" target: "9" label: "d" arrowstyle: line } -edge: { source: "14" target: "16" label: "a" arrowstyle: line } -edge: { source: "15" target: "10" label: "d" arrowstyle: line } -edge: { source: "15" target: "16" label: "c" arrowstyle: line } -edge: { source: "16" target: "11" label: "d" arrowstyle: line } -edge: { source: "17" target: "13" label: "d" arrowstyle: line } -edge: { source: "17" target: "16" label: "b" arrowstyle: line } -} - - Deleted: trunk/perl-flat/dev-scripts/nfa.png =================================================================== (Binary files differ) Deleted: trunk/perl-flat/dev-scripts/output.png =================================================================== (Binary files differ) Deleted: trunk/perl-flat/dev-scripts/pfa.gdl =================================================================== --- trunk/perl-flat/dev-scripts/pfa.gdl 2007-02-09 17:16:21 UTC (rev 84) +++ trunk/perl-flat/dev-scripts/pfa.gdl 2007-02-09 17:17:25 UTC (rev 85) @@ -1,29 +0,0 @@ -graph: { -display_edge_labels: yes - -node: { title:"0" shape:circle borderstyle: solid} -node: { title:"1" shape:circle borderstyle: solid} -node: { title:"2" shape:circle borderstyle: solid} -node: { title:"3" shape:circle borderstyle: solid} -node: { title:"4" shape:circle borderstyle: solid} -node: { title:"5" shape:circle borderstyle: solid} -node: { title:"6" shape:circle borderstyle: solid} -node: { title:"7" shape:circle borderstyle: solid} -node: { title:"8" shape:circle borderstyle: solid} -node: { title:"9" shape:circle borderstyle: double bordercolor: red} - -edge: { source: "0" target: "1" label: "a" arrowstyle: line } -edge: { source: "1" target: "9" label: "#lambda" arrowstyle: line } -edge: { source: "2" target: "3" label: "b" arrowstyle: line } -edge: { source: "3" target: "9" label: "#lambda" arrowstyle: line } -edge: { source: "4" target: "5" label: "c" arrowstyle: line } -edge: { source: "5" target: "9" label: "#lambda" arrowstyle: line } -edge: { source: "6" target: "7" label: "d" arrowstyle: line } -edge: { source: "7" target: "9" label: "#lambda" arrowstyle: line } -edge: { source: "8" target: "0" label: "#lambda" arrowstyle: line } -edge: { source: "8" target: "2" label: "#lambda" arrowstyle: line } -edge: { source: "8" target: "4" label: "#lambda" arrowstyle: line } -edge: { source: "8" target: "6" label: "#lambda" arrowstyle: line } -} - - Deleted: trunk/perl-flat/dev-scripts/pfa.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2007-02-09 17:25:12
|
Revision: 84 http://svn.sourceforge.net/perl-flat/?rev=84&view=rev Author: estrabd Date: 2007-02-09 09:16:21 -0800 (Fri, 09 Feb 2007) Log Message: ----------- added another pfa test Modified Paths: -------------- trunk/perl-flat/dev-scripts/test.sh trunk/perl-flat/t/03-pregex-pfa.t Added Paths: ----------- trunk/perl-flat/dev-scripts/dfa.gdl trunk/perl-flat/dev-scripts/dfa.png trunk/perl-flat/dev-scripts/mindfa.gdl trunk/perl-flat/dev-scripts/mindfa.png trunk/perl-flat/dev-scripts/nfa.gdl trunk/perl-flat/dev-scripts/nfa.png trunk/perl-flat/dev-scripts/output.png trunk/perl-flat/dev-scripts/pfa.gdl trunk/perl-flat/dev-scripts/pfa.png Added: trunk/perl-flat/dev-scripts/dfa.gdl =================================================================== --- trunk/perl-flat/dev-scripts/dfa.gdl (rev 0) +++ trunk/perl-flat/dev-scripts/dfa.gdl 2007-02-09 17:16:21 UTC (rev 84) @@ -0,0 +1,72 @@ +graph: { +display_edge_labels: yes + +node: { title:"0" shape:circle borderstyle: solid} +node: { title:"1" shape:circle borderstyle: solid} +node: { title:"2" shape:circle borderstyle: solid} +node: { title:"3" shape:circle borderstyle: solid} +node: { title:"4" shape:circle borderstyle: solid} +node: { title:"5" shape:circle borderstyle: solid} +node: { title:"6" shape:circle borderstyle: solid} +node: { title:"7" shape:circle borderstyle: solid} +node: { title:"8" shape:circle borderstyle: solid} +node: { title:"9" shape:circle borderstyle: solid} +node: { title:"10" shape:circle borderstyle: solid} +node: { title:"11" shape:circle borderstyle: solid} +node: { title:"12" shape:circle borderstyle: solid} +node: { title:"13" shape:circle borderstyle: solid} +node: { title:"14" shape:circle borderstyle: solid} +node: { title:"15" shape:circle borderstyle: solid} +node: { title:"16" shape:circle borderstyle: double bordercolor: red} + +edge: { source: "0" target: "1" label: "c" arrowstyle: line } +edge: { source: "0" target: "2" label: "a" arrowstyle: line } +edge: { source: "0" target: "3" label: "b" arrowstyle: line } +edge: { source: "0" target: "4" label: "d" arrowstyle: line } +edge: { source: "1" target: "5" label: "c" arrowstyle: line } +edge: { source: "1" target: "6" label: "a" arrowstyle: line } +edge: { source: "1" target: "7" label: "b" arrowstyle: line } +edge: { source: "1" target: "8" label: "d" arrowstyle: line } +edge: { source: "2" target: "5" label: "a" arrowstyle: line } +edge: { source: "2" target: "6" label: "c" arrowstyle: line } +edge: { source: "2" target: "9" label: "b" arrowstyle: line } +edge: { source: "2" target: "10" label: "d" arrowstyle: line } +edge: { source: "3" target: "5" label: "b" arrowstyle: line } +edge: { source: "3" target: "7" label: "c" arrowstyle: line } +edge: { source: "3" target: "9" label: "a" arrowstyle: line } +edge: { source: "3" target: "11" label: "d" arrowstyle: line } +edge: { source: "4" target: "5" label: "d" arrowstyle: line } +edge: { source: "4" target: "8" label: "c" arrowstyle: line } +edge: { source: "4" target: "10" label: "a" arrowstyle: line } +edge: { source: "4" target: "11" label: "b" arrowstyle: line } +edge: { source: "5" target: "5" label: "a,b,c,d" arrowstyle: line } +edge: { source: "6" target: "5" label: "a,c" arrowstyle: line } +edge: { source: "6" target: "12" label: "b" arrowstyle: line } +edge: { source: "6" target: "13" label: "d" arrowstyle: line } +edge: { source: "7" target: "5" label: "b,c" arrowstyle: line } +edge: { source: "7" target: "12" label: "a" arrowstyle: line } +edge: { source: "7" target: "14" label: "d" arrowstyle: line } +edge: { source: "8" target: "5" label: "c,d" arrowstyle: line } +edge: { source: "8" target: "13" label: "a" arrowstyle: line } +edge: { source: "8" target: "14" label: "b" arrowstyle: line } +edge: { source: "9" target: "5" label: "a,b" arrowstyle: line } +edge: { source: "9" target: "12" label: "c" arrowstyle: line } +edge: { source: "9" target: "15" label: "d" arrowstyle: line } +edge: { source: "10" target: "5" label: "a,d" arrowstyle: line } +edge: { source: "10" target: "13" label: "c" arrowstyle: line } +edge: { source: "10" target: "15" label: "b" arrowstyle: line } +edge: { source: "11" target: "5" label: "b,d" arrowstyle: line } +edge: { source: "11" target: "14" label: "c" arrowstyle: line } +edge: { source: "11" target: "15" label: "a" arrowstyle: line } +edge: { source: "12" target: "5" label: "a,b,c" arrowstyle: line } +edge: { source: "12" target: "16" label: "d" arrowstyle: line } +edge: { source: "13" target: "5" label: "a,c,d" arrowstyle: line } +edge: { source: "13" target: "16" label: "b" arrowstyle: line } +edge: { source: "14" target: "5" label: "b,c,d" arrowstyle: line } +edge: { source: "14" target: "16" label: "a" arrowstyle: line } +edge: { source: "15" target: "5" label: "a,b,d" arrowstyle: line } +edge: { source: "15" target: "16" label: "c" arrowstyle: line } +edge: { source: "16" target: "5" label: "a,b,c,d" arrowstyle: line } +} + + Added: trunk/perl-flat/dev-scripts/dfa.png =================================================================== (Binary files differ) Property changes on: trunk/perl-flat/dev-scripts/dfa.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/perl-flat/dev-scripts/mindfa.gdl =================================================================== --- trunk/perl-flat/dev-scripts/mindfa.gdl (rev 0) +++ trunk/perl-flat/dev-scripts/mindfa.gdl 2007-02-09 17:16:21 UTC (rev 84) @@ -0,0 +1,55 @@ +graph: { +display_edge_labels: yes + +node: { title:"0" shape:circle borderstyle: solid} +node: { title:"1" shape:circle borderstyle: solid} +node: { title:"2" shape:circle borderstyle: solid} +node: { title:"3" shape:circle borderstyle: solid} +node: { title:"4" shape:circle borderstyle: solid} +node: { title:"5" shape:circle borderstyle: solid} +node: { title:"6" shape:circle borderstyle: solid} +node: { title:"7" shape:circle borderstyle: solid} +node: { title:"8" shape:circle borderstyle: solid} +node: { title:"9" shape:circle borderstyle: solid} +node: { title:"10" shape:circle borderstyle: solid} +node: { title:"11" shape:circle borderstyle: solid} +node: { title:"12" shape:circle borderstyle: solid} +node: { title:"13" shape:circle borderstyle: solid} +node: { title:"14" shape:circle borderstyle: solid} +node: { title:"15" shape:circle borderstyle: double bordercolor: red} + +edge: { source: "0" target: "1" label: "c" arrowstyle: line } +edge: { source: "0" target: "2" label: "a" arrowstyle: line } +edge: { source: "0" target: "3" label: "b" arrowstyle: line } +edge: { source: "0" target: "4" label: "d" arrowstyle: line } +edge: { source: "1" target: "5" label: "a" arrowstyle: line } +edge: { source: "1" target: "6" label: "b" arrowstyle: line } +edge: { source: "1" target: "7" label: "d" arrowstyle: line } +edge: { source: "2" target: "5" label: "c" arrowstyle: line } +edge: { source: "2" target: "8" label: "b" arrowstyle: line } +edge: { source: "2" target: "9" label: "d" arrowstyle: line } +edge: { source: "3" target: "6" label: "c" arrowstyle: line } +edge: { source: "3" target: "8" label: "a" arrowstyle: line } +edge: { source: "3" target: "10" label: "d" arrowstyle: line } +edge: { source: "4" target: "7" label: "c" arrowstyle: line } +edge: { source: "4" target: "9" label: "a" arrowstyle: line } +edge: { source: "4" target: "10" label: "b" arrowstyle: line } +edge: { source: "5" target: "11" label: "b" arrowstyle: line } +edge: { source: "5" target: "12" label: "d" arrowstyle: line } +edge: { source: "6" target: "11" label: "a" arrowstyle: line } +edge: { source: "6" target: "13" label: "d" arrowstyle: line } +edge: { source: "7" target: "12" label: "a" arrowstyle: line } +edge: { source: "7" target: "13" label: "b" arrowstyle: line } +edge: { source: "8" target: "11" label: "c" arrowstyle: line } +edge: { source: "8" target: "14" label: "d" arrowstyle: line } +edge: { source: "9" target: "12" label: "c" arrowstyle: line } +edge: { source: "9" target: "14" label: "b" arrowstyle: line } +edge: { source: "10" target: "13" label: "c" arrowstyle: line } +edge: { source: "10" target: "14" label: "a" arrowstyle: line } +edge: { source: "11" target: "15" label: "d" arrowstyle: line } +edge: { source: "12" target: "15" label: "b" arrowstyle: line } +edge: { source: "13" target: "15" label: "a" arrowstyle: line } +edge: { source: "14" target: "15" label: "c" arrowstyle: line } +} + + Added: trunk/perl-flat/dev-scripts/mindfa.png =================================================================== (Binary files differ) Property changes on: trunk/perl-flat/dev-scripts/mindfa.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/perl-flat/dev-scripts/nfa.gdl =================================================================== --- trunk/perl-flat/dev-scripts/nfa.gdl (rev 0) +++ trunk/perl-flat/dev-scripts/nfa.gdl 2007-02-09 17:16:21 UTC (rev 84) @@ -0,0 +1,59 @@ +graph: { +display_edge_labels: yes + +node: { title:"0" shape:circle borderstyle: solid} +node: { title:"1" shape:circle borderstyle: solid} +node: { title:"2" shape:circle borderstyle: solid} +node: { title:"3" shape:circle borderstyle: solid} +node: { title:"4" shape:circle borderstyle: solid} +node: { title:"5" shape:circle borderstyle: solid} +node: { title:"6" shape:circle borderstyle: solid} +node: { title:"7" shape:circle borderstyle: solid} +node: { title:"8" shape:circle borderstyle: solid} +node: { title:"9" shape:circle borderstyle: solid} +node: { title:"10" shape:circle borderstyle: solid} +node: { title:"11" shape:circle borderstyle: solid} +node: { title:"12" shape:circle borderstyle: double bordercolor: red} +node: { title:"13" shape:circle borderstyle: solid} +node: { title:"14" shape:circle borderstyle: solid} +node: { title:"15" shape:circle borderstyle: solid} +node: { title:"16" shape:circle borderstyle: solid} +node: { title:"17" shape:circle borderstyle: solid} + +edge: { source: "0" target: "1" label: "epsilon" arrowstyle: line } +edge: { source: "1" target: "2" label: "c" arrowstyle: line } +edge: { source: "1" target: "3" label: "a" arrowstyle: line } +edge: { source: "1" target: "4" label: "b" arrowstyle: line } +edge: { source: "1" target: "5" label: "d" arrowstyle: line } +edge: { source: "2" target: "6" label: "d" arrowstyle: line } +edge: { source: "2" target: "14" label: "b" arrowstyle: line } +edge: { source: "2" target: "17" label: "a" arrowstyle: line } +edge: { source: "3" target: "7" label: "d" arrowstyle: line } +edge: { source: "3" target: "15" label: "b" arrowstyle: line } +edge: { source: "3" target: "17" label: "c" arrowstyle: line } +edge: { source: "4" target: "8" label: "d" arrowstyle: line } +edge: { source: "4" target: "14" label: "c" arrowstyle: line } +edge: { source: "4" target: "15" label: "a" arrowstyle: line } +edge: { source: "5" target: "6" label: "c" arrowstyle: line } +edge: { source: "5" target: "7" label: "a" arrowstyle: line } +edge: { source: "5" target: "8" label: "b" arrowstyle: line } +edge: { source: "6" target: "9" label: "b" arrowstyle: line } +edge: { source: "6" target: "13" label: "a" arrowstyle: line } +edge: { source: "7" target: "10" label: "b" arrowstyle: line } +edge: { source: "7" target: "13" label: "c" arrowstyle: line } +edge: { source: "8" target: "9" label: "c" arrowstyle: line } +edge: { source: "8" target: "10" label: "a" arrowstyle: line } +edge: { source: "9" target: "11" label: "a" arrowstyle: line } +edge: { source: "10" target: "11" label: "c" arrowstyle: line } +edge: { source: "11" target: "12" label: "epsilon" arrowstyle: line } +edge: { source: "13" target: "11" label: "b" arrowstyle: line } +edge: { source: "14" target: "9" label: "d" arrowstyle: line } +edge: { source: "14" target: "16" label: "a" arrowstyle: line } +edge: { source: "15" target: "10" label: "d" arrowstyle: line } +edge: { source: "15" target: "16" label: "c" arrowstyle: line } +edge: { source: "16" target: "11" label: "d" arrowstyle: line } +edge: { source: "17" target: "13" label: "d" arrowstyle: line } +edge: { source: "17" target: "16" label: "b" arrowstyle: line } +} + + Added: trunk/perl-flat/dev-scripts/nfa.png =================================================================== (Binary files differ) Property changes on: trunk/perl-flat/dev-scripts/nfa.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/perl-flat/dev-scripts/output.png =================================================================== (Binary files differ) Property changes on: trunk/perl-flat/dev-scripts/output.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/perl-flat/dev-scripts/pfa.gdl =================================================================== --- trunk/perl-flat/dev-scripts/pfa.gdl (rev 0) +++ trunk/perl-flat/dev-scripts/pfa.gdl 2007-02-09 17:16:21 UTC (rev 84) @@ -0,0 +1,29 @@ +graph: { +display_edge_labels: yes + +node: { title:"0" shape:circle borderstyle: solid} +node: { title:"1" shape:circle borderstyle: solid} +node: { title:"2" shape:circle borderstyle: solid} +node: { title:"3" shape:circle borderstyle: solid} +node: { title:"4" shape:circle borderstyle: solid} +node: { title:"5" shape:circle borderstyle: solid} +node: { title:"6" shape:circle borderstyle: solid} +node: { title:"7" shape:circle borderstyle: solid} +node: { title:"8" shape:circle borderstyle: solid} +node: { title:"9" shape:circle borderstyle: double bordercolor: red} + +edge: { source: "0" target: "1" label: "a" arrowstyle: line } +edge: { source: "1" target: "9" label: "#lambda" arrowstyle: line } +edge: { source: "2" target: "3" label: "b" arrowstyle: line } +edge: { source: "3" target: "9" label: "#lambda" arrowstyle: line } +edge: { source: "4" target: "5" label: "c" arrowstyle: line } +edge: { source: "5" target: "9" label: "#lambda" arrowstyle: line } +edge: { source: "6" target: "7" label: "d" arrowstyle: line } +edge: { source: "7" target: "9" label: "#lambda" arrowstyle: line } +edge: { source: "8" target: "0" label: "#lambda" arrowstyle: line } +edge: { source: "8" target: "2" label: "#lambda" arrowstyle: line } +edge: { source: "8" target: "4" label: "#lambda" arrowstyle: line } +edge: { source: "8" target: "6" label: "#lambda" arrowstyle: line } +} + + Added: trunk/perl-flat/dev-scripts/pfa.png =================================================================== (Binary files differ) Property changes on: trunk/perl-flat/dev-scripts/pfa.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: trunk/perl-flat/dev-scripts/test.sh =================================================================== --- trunk/perl-flat/dev-scripts/test.sh 2006-12-14 01:54:44 UTC (rev 83) +++ trunk/perl-flat/dev-scripts/test.sh 2007-02-09 17:16:21 UTC (rev 84) @@ -1,5 +1 @@ -perl pregex-to-pfa.pl "${1}" -~/distfiles/aiSee/bin/aisee.bin -pngoutput pfa.png pfa.gdl -~/distfiles/aiSee/bin/aisee.bin -pngoutput nfa.png nfa.gdl -~/distfiles/aiSee/bin/aisee.bin -pngoutput dfa.png dfa.gdl -~/distfiles/aiSee/bin/aisee.bin -pngoutput mindfa.png mindfa.gdl +perl pre_compare.pl 'nop(abc)*hij&qrs(def)*klm' 'n(op(abc)*hij&qrs(def)*klm)+q(rs(def)*klm&nop(abc)*hij)' Modified: trunk/perl-flat/t/03-pregex-pfa.t =================================================================== --- trunk/perl-flat/t/03-pregex-pfa.t 2006-12-14 01:54:44 UTC (rev 83) +++ trunk/perl-flat/t/03-pregex-pfa.t 2007-02-09 17:16:21 UTC (rev 84) @@ -11,29 +11,30 @@ diag("This test will take a while.."); +diag("w&v.."); # w&w my $PFA1 = FLAT::Regex::WithExtraOps->new('abc&def')->as_pfa(); my $PFA2 = FLAT::Regex::WithExtraOps->new('a(b(c&def)+d(ef&bc))+d(ef&abc)')->as_pfa(); - my $DFA1 = $PFA1->as_nfa->as_min_dfa; my $DFA2 = $PFA2->as_nfa->as_min_dfa; is( ($DFA1->equals($DFA2)), 1 ); -# w&w* +diag("w&v*.."); +# w&v* $PFA1 = FLAT::Regex::WithExtraOps->new('abc&(def)*')->as_pfa(); $PFA2 = FLAT::Regex::WithExtraOps->new('(def)*( - a(bc&(def)*)+ - d((efd)*ef&(abc))+ - d((efd)*&(abc))ef - )')->as_pfa(); + a(bc&(def)*)+ + d((efd)*ef&(abc))+ + d((efd)*&(abc))ef + )')->as_pfa(); $DFA1 = $PFA1->as_nfa->as_min_dfa; $DFA2 = $PFA2->as_nfa->as_min_dfa; is( ($DFA1->equals($DFA2)), 1); -# w*&w* +# w*&v* # throws some weird warning from FA.pm when mimimizing, but passes still #$PFA1 = FLAT::Regex::WithExtraOps->new('(abc)*&(def)*')->as_pfa(); #$PFA2 = FLAT::Regex::WithExtraOps->new('((abc+def)*( @@ -43,24 +44,28 @@ # d((efd)*&(abc)*)ef # )*)*')->as_pfa(); -#$DFA1 = $PFA1->as_nfa->as_min_dfa; -#$DFA2 = $PFA2->as_nfa->as_min_dfa; -# is( ($DFA1->equals($DFA2)), 1); +$DFA1 = $PFA1->as_nfa->as_min_dfa; +$DFA2 = $PFA2->as_nfa->as_min_dfa; + is( ($DFA1->equals($DFA2)), 1); -# w*x&w*y -$PFA1 = FLAT::Regex::WithExtraOps->new('(abc)*dx&(efg)*hy')->as_pfa(); #<--! -$PFA2 = FLAT::Regex::WithExtraOps->new('(abc+efg)*( - dx&(efg)*hy+ - hy&(abc)*dx+ - a(((bca)*bcdx)&((efg)*hy))+ - a(((bca)*)&((efg)*hy))bcdx+ - e(((fge)*fghy)&((abc)*dx))+ - e(((fge)*)&((abc)*dx))fghy - )')->as_pfa(); +diag("w*x&v*y.."); +# w*x&v*y +$PFA1 = FLAT::Regex::WithExtraOps->new('(abc)*dx&(efg)*hy')->as_pfa(); +$PFA2 = FLAT::Regex::WithExtraOps->new('(abc+efg)*( dx&(efg)*hy+ + hy&(abc)*dx+ + a(((bca)*bcdx)&((efg)*hy))+ + a(((bca)*)&((efg)*hy))bcdx+ + e(((fge)*fghy)&((abc)*dx))+ + e(((fge)*)&((abc)*dx))fghy + )')->as_pfa(); $DFA1 = $PFA1->as_nfa->as_min_dfa; $DFA2 = $PFA2->as_nfa->as_min_dfa; +is( ($DFA1->equals($DFA2)), 1); +$PFA1 = FLAT::Regex::WithExtraOps->new('nop(abc)*hij&qrs(def)*klm')->as_pfa(); +$PFA2 = FLAT::Regex::WithExtraOps->new('n(op(abc)*hij&qrs(def)*klm)+q(rs(def)*klm&nop(abc)*hij)')->as_pfa(); + +$DFA1 = $PFA1->as_nfa->as_min_dfa; +$DFA2 = $PFA2->as_nfa->as_min_dfa; is( ($DFA1->equals($DFA2)), 1); - -__END__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2006-12-14 01:54:48
|
Revision: 83 http://svn.sourceforge.net/perl-flat/?rev=83&view=rev Author: estrabd Date: 2006-12-13 17:54:44 -0800 (Wed, 13 Dec 2006) Log Message: ----------- added some tests Modified Paths: -------------- trunk/perl-flat/dev-scripts/bdetest.pl trunk/perl-flat/dev-scripts/pre_compare.pl trunk/perl-flat/dev-scripts/test.sh trunk/perl-flat/t/03-pregex-pfa.t Modified: trunk/perl-flat/dev-scripts/bdetest.pl =================================================================== --- trunk/perl-flat/dev-scripts/bdetest.pl 2006-10-07 12:52:05 UTC (rev 82) +++ trunk/perl-flat/dev-scripts/bdetest.pl 2006-12-14 01:54:44 UTC (rev 83) @@ -4,11 +4,26 @@ use lib qw(../lib); use FLAT; use FLAT::NFA; -use FLAT::Regex; +use FLAT::PFA; +use FLAT::Regex::WithExtraOps; use Data::Dumper; # This is mainly my test script for FLAT::FA::PFA.pm -my $DFA = FLAT::Regex->new('ab+ba')->as_nfa->as_min_dfa; +#my $DFA = FLAT::Regex->new('ab+ba')->as_nfa->as_min_dfa; +#print $DFA->as_gdl; -print $DFA->as_gdl; +my $PFA1 = FLAT::Regex::WithExtraOps->new('(abc)*dx&(efg)*hy')->as_pfa(); #<--! +my $PFA2 = FLAT::Regex::WithExtraOps->new('(abc+efg)*( + dx&(efg)*hy+ + hy&(abc)*dx+ + a(((bca)*bcdx)&((efg)*hy))+ + a(((bca)*)&((efg)*hy))bcdx+ + e(((fge)*fghy)&((abc)*dx))+ + e(((fge)*)&((abc)*dx))fghy + )')->as_pfa(); + +my $DFA1 = $PFA1->as_nfa->as_min_dfa; +my $DFA2 = $PFA2->as_nfa->as_min_dfa; + +print $DFA1->equals($DFA2); Modified: trunk/perl-flat/dev-scripts/pre_compare.pl =================================================================== --- trunk/perl-flat/dev-scripts/pre_compare.pl 2006-10-07 12:52:05 UTC (rev 82) +++ trunk/perl-flat/dev-scripts/pre_compare.pl 2006-12-14 01:54:44 UTC (rev 83) @@ -19,31 +19,3 @@ } else { print "No Match"; } - -__END__ -open(GDL,">pfa.gdl"); - print GDL $PFA->as_gdl,"\n"; -close(GDL); - -my $NFA = $PFA->as_nfa(); - -open(GDL,">nfa.gdl"); - print GDL $NFA->as_gdl,"\n"; -close(GDL); - -my $DFA = $NFA->as_dfa(); - -open(GDL,">dfa.gdl"); - print GDL $DFA->as_gdl,"\n"; -close(GDL); - -open(GDL,">mindfa.gdl"); - print GDL $DFA->as_min_dfa->trim_sinks->as_gdl,"\n"; -close(GDL); - -my $dot = $DFA->as_min_dfa->as_graphviz; -open my $fh, "|-", "circo -Tpng -o output.png" - or die "Couldn't run dot: $!\n"; - -print $fh $dot; -close $fh; Modified: trunk/perl-flat/dev-scripts/test.sh =================================================================== --- trunk/perl-flat/dev-scripts/test.sh 2006-10-07 12:52:05 UTC (rev 82) +++ trunk/perl-flat/dev-scripts/test.sh 2006-12-14 01:54:44 UTC (rev 83) @@ -1,10 +1,5 @@ perl pregex-to-pfa.pl "${1}" -rm *.gdl *.png ~/distfiles/aiSee/bin/aisee.bin -pngoutput pfa.png pfa.gdl ~/distfiles/aiSee/bin/aisee.bin -pngoutput nfa.png nfa.gdl ~/distfiles/aiSee/bin/aisee.bin -pngoutput dfa.png dfa.gdl ~/distfiles/aiSee/bin/aisee.bin -pngoutput mindfa.png mindfa.gdl -#qiv pfa.png& -#qiv nfa.png& -#qiv dfa.png& -qiv mindfa.png& Modified: trunk/perl-flat/t/03-pregex-pfa.t =================================================================== --- trunk/perl-flat/t/03-pregex-pfa.t 2006-10-07 12:52:05 UTC (rev 82) +++ trunk/perl-flat/t/03-pregex-pfa.t 2006-12-14 01:54:44 UTC (rev 83) @@ -1,10 +1,16 @@ -use Test::More tests => 2; +use Test::More 'no_plan'; + +use strict; + +use lib qw(../lib); use FLAT; +use FLAT::DFA; use FLAT::NFA; use FLAT::PFA; -use FLAT::DFA; use FLAT::Regex::WithExtraOps; +diag("This test will take a while.."); + # w&w my $PFA1 = FLAT::Regex::WithExtraOps->new('abc&def')->as_pfa(); my $PFA2 = FLAT::Regex::WithExtraOps->new('a(b(c&def)+d(ef&bc))+d(ef&abc)')->as_pfa(); @@ -12,24 +18,49 @@ my $DFA1 = $PFA1->as_nfa->as_min_dfa; my $DFA2 = $PFA2->as_nfa->as_min_dfa; -ok( ($DFA1->equals($DFA2)) ); +is( ($DFA1->equals($DFA2)), 1 ); # w&w* $PFA1 = FLAT::Regex::WithExtraOps->new('abc&(def)*')->as_pfa(); -$PFA2 = FLAT::Regex::WithExtraOps->new('(def)*(a(bc&(def)*)+d((efd)*ef&(abc))+d((efd)*&(abc))ef)')->as_pfa(); +$PFA2 = FLAT::Regex::WithExtraOps->new('(def)*( + a(bc&(def)*)+ + d((efd)*ef&(abc))+ + d((efd)*&(abc))ef + )')->as_pfa(); $DFA1 = $PFA1->as_nfa->as_min_dfa; $DFA2 = $PFA2->as_nfa->as_min_dfa; -ok( ($DFA1->equals($DFA2)) ); +is( ($DFA1->equals($DFA2)), 1); -__END__ # w*&w* -# throws some weird warning from FA.pm, but passes still -$PFA1 = FLAT::Regex::WithExtraOps->new('(abc)*&(def)*')->as_pfa(); -$PFA2 = FLAT::Regex::WithExtraOps->new('((abc+def)*(a((bca)*bc&(def)*)+a((bca)*&(def)*)bc+d((efd)*ef&(abc)*)+d((efd)*&(abc)*)ef)*)*')->as_pfa(); +# throws some weird warning from FA.pm when mimimizing, but passes still +#$PFA1 = FLAT::Regex::WithExtraOps->new('(abc)*&(def)*')->as_pfa(); +#$PFA2 = FLAT::Regex::WithExtraOps->new('((abc+def)*( +# a((bca)*bc&(def)*)+ +# a((bca)*&(def)*)bc+ +# d((efd)*ef&(abc)*)+ +# d((efd)*&(abc)*)ef +# )*)*')->as_pfa(); +#$DFA1 = $PFA1->as_nfa->as_min_dfa; +#$DFA2 = $PFA2->as_nfa->as_min_dfa; +# is( ($DFA1->equals($DFA2)), 1); + +# w*x&w*y +$PFA1 = FLAT::Regex::WithExtraOps->new('(abc)*dx&(efg)*hy')->as_pfa(); #<--! +$PFA2 = FLAT::Regex::WithExtraOps->new('(abc+efg)*( + dx&(efg)*hy+ + hy&(abc)*dx+ + a(((bca)*bcdx)&((efg)*hy))+ + a(((bca)*)&((efg)*hy))bcdx+ + e(((fge)*fghy)&((abc)*dx))+ + e(((fge)*)&((abc)*dx))fghy + )')->as_pfa(); + $DFA1 = $PFA1->as_nfa->as_min_dfa; $DFA2 = $PFA2->as_nfa->as_min_dfa; -ok( ($DFA1->equals($DFA2)) ); +is( ($DFA1->equals($DFA2)), 1); + +__END__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2006-10-07 12:52:11
|
Revision: 82 http://svn.sourceforge.net/perl-flat/?rev=82&view=rev Author: estrabd Date: 2006-10-07 05:52:05 -0700 (Sat, 07 Oct 2006) Log Message: ----------- just in case I missed something Modified Paths: -------------- trunk/perl-flat/dev-scripts/pre_compare.pl trunk/perl-flat/dev-scripts/pregex-to-pfa.pl trunk/perl-flat/t/03-pregex-pfa.t Modified: trunk/perl-flat/dev-scripts/pre_compare.pl =================================================================== --- trunk/perl-flat/dev-scripts/pre_compare.pl 2006-10-03 22:40:35 UTC (rev 81) +++ trunk/perl-flat/dev-scripts/pre_compare.pl 2006-10-07 12:52:05 UTC (rev 82) @@ -14,7 +14,11 @@ my $DFA1 = $PFA1->as_nfa->as_min_dfa; my $DFA2 = $PFA2->as_nfa->as_min_dfa; -print "Match!" if ($DFA1->equals($DFA2)); +if ($DFA1->equals($DFA2)) { + print "MATCH!"; +} else { + print "No Match"; +} __END__ open(GDL,">pfa.gdl"); Modified: trunk/perl-flat/dev-scripts/pregex-to-pfa.pl =================================================================== --- trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-10-03 22:40:35 UTC (rev 81) +++ trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-10-07 12:52:05 UTC (rev 82) @@ -30,7 +30,7 @@ print GDL $DFA->as_min_dfa->trim_sinks->as_gdl,"\n"; close(GDL); -my $dot = $DFA->as_min_dfa->as_graphviz; +my $dot = $DFA->as_min_dfa->trim_sinks->as_graphviz; open my $fh, "|-", "circo -Tpng -o output.png" or die "Couldn't run dot: $!\n"; Modified: trunk/perl-flat/t/03-pregex-pfa.t =================================================================== --- trunk/perl-flat/t/03-pregex-pfa.t 2006-10-03 22:40:35 UTC (rev 81) +++ trunk/perl-flat/t/03-pregex-pfa.t 2006-10-07 12:52:05 UTC (rev 82) @@ -1,4 +1,4 @@ -use Test::More tests => 3; +use Test::More tests => 2; use FLAT; use FLAT::NFA; use FLAT::PFA; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2006-10-04 05:40:27
|
Revision: 79 http://svn.sourceforge.net/perl-flat/?rev=79&view=rev Author: estrabd Date: 2006-10-03 12:04:14 -0700 (Tue, 03 Oct 2006) Log Message: ----------- working on pre tests Modified Paths: -------------- trunk/perl-flat/dev-scripts/pregex-stress.pl trunk/perl-flat/dev-scripts/pregex-to-pfa.pl trunk/perl-flat/lib/FLAT/DFA.pm trunk/perl-flat/lib/FLAT/PFA.pm Added Paths: ----------- trunk/perl-flat/dev-scripts/pre_compare.pl Added: trunk/perl-flat/dev-scripts/pre_compare.pl =================================================================== --- trunk/perl-flat/dev-scripts/pre_compare.pl (rev 0) +++ trunk/perl-flat/dev-scripts/pre_compare.pl 2006-10-03 19:04:14 UTC (rev 79) @@ -0,0 +1,45 @@ +#!/usr/bin/env perl -l +use strict; + +use lib qw(../lib); +use FLAT::Regex::WithExtraOps; +use FLAT::PFA; +use Data::Dumper; + +# This is mainly my test script for FLAT::FA::PFA.pm + +my $PFA1 = FLAT::Regex::WithExtraOps->new($ARGV[0])->as_pfa(); +my $PFA2 = FLAT::Regex::WithExtraOps->new($ARGV[1])->as_pfa(); + +my $DFA1 = $PFA1->as_nfa->as_min_dfa; +my $DFA2 = $PFA2->as_nfa->as_min_dfa; + +print "Match!" if ($DFA1->equals($DFA2)); + +__END__ +open(GDL,">pfa.gdl"); + print GDL $PFA->as_gdl,"\n"; +close(GDL); + +my $NFA = $PFA->as_nfa(); + +open(GDL,">nfa.gdl"); + print GDL $NFA->as_gdl,"\n"; +close(GDL); + +my $DFA = $NFA->as_dfa(); + +open(GDL,">dfa.gdl"); + print GDL $DFA->as_gdl,"\n"; +close(GDL); + +open(GDL,">mindfa.gdl"); + print GDL $DFA->as_min_dfa->trim_sinks->as_gdl,"\n"; +close(GDL); + +my $dot = $DFA->as_min_dfa->as_graphviz; +open my $fh, "|-", "circo -Tpng -o output.png" + or die "Couldn't run dot: $!\n"; + +print $fh $dot; +close $fh; Modified: trunk/perl-flat/dev-scripts/pregex-stress.pl =================================================================== --- trunk/perl-flat/dev-scripts/pregex-stress.pl 2006-10-03 13:41:20 UTC (rev 78) +++ trunk/perl-flat/dev-scripts/pregex-stress.pl 2006-10-03 19:04:14 UTC (rev 79) @@ -4,6 +4,7 @@ use lib qw(../lib); use FLAT; use FLAT::Regex::WithExtraOps; +use FLAT::PFA; use Data::Dumper; use Getopt::Long; # used to process commandline options $|++; @@ -18,7 +19,6 @@ $CMDLINEOPTS{AND} = 10; $CMDLINEOPTS{OR} = 6; $CMDLINEOPTS{STAR} = 10; -$CMDLINEOPTS{NEGATE} = 0; $CMDLINEOPTS{OPEN} = 5; $CMDLINEOPTS{CLOSE} = 0; $CMDLINEOPTS{n} = 100; @@ -49,16 +49,14 @@ $str .= getRandomChar(); # % chance of an "or" if (int(rand 100) < $CMDLINEOPTS{OR}) { - $str .= "|[]"; + $str .= "|1"; } elsif (int(rand 100) < $CMDLINEOPTS{AND}) { - $str .= "&[]"; + $str .= "&0"; } elsif (int(rand 100) < $CMDLINEOPTS{STAR}) { - $str .= "*"; - } elsif (int(rand 100) < $CMDLINEOPTS{NEGATE}) { - $str .= "~".getRandomChar(); + $str .= "*1"; } elsif (int(rand 100) < $CMDLINEOPTS{OPEN}) { $str .= "("; - push(@closeparens,'[])'); + push(@closeparens,'0101)'); } elsif (int(rand 100) < $CMDLINEOPTS{CLOSE} && @closeparens) { $str .= pop(@closeparens); } @@ -72,6 +70,7 @@ for (1..$CMDLINEOPTS{n}) { my $str = getRandomRE(); - my $RE = FLAT::Regex::WithExtraOps->new($str); - print "$str : ".$RE->as_string; + my $PRE = FLAT::Regex::WithExtraOps->new($str); + print $PRE->as_string; + my $minDFA = $PRE->as_pfa->as_nfa->as_min_dfa(); } Modified: trunk/perl-flat/dev-scripts/pregex-to-pfa.pl =================================================================== --- trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-10-03 13:41:20 UTC (rev 78) +++ trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-10-03 19:04:14 UTC (rev 79) @@ -29,3 +29,10 @@ open(GDL,">mindfa.gdl"); print GDL $DFA->as_min_dfa->trim_sinks->as_gdl,"\n"; close(GDL); + +my $dot = $DFA->as_min_dfa->as_graphviz; +open my $fh, "|-", "circo -Tpng -o output.png" + or die "Couldn't run dot: $!\n"; + +print $fh $dot; +close $fh; Modified: trunk/perl-flat/lib/FLAT/DFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/DFA.pm 2006-10-03 13:41:20 UTC (rev 78) +++ trunk/perl-flat/lib/FLAT/DFA.pm 2006-10-03 19:04:14 UTC (rev 79) @@ -52,7 +52,7 @@ my @next = map { $dfas[$_]->successors( $tuple[$_], $char ) } 0 .. $#dfas; - warn "[@tuple] --> [@next] via $char\n"; + #warn "[@tuple] --> [@next] via $char\n"; if (not exists $newstates{ _TUPLE_ID(@next) }) { my $s = $newstates{ _TUPLE_ID(@next) } = $return->add_states(1); Modified: trunk/perl-flat/lib/FLAT/PFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/PFA.pm 2006-10-03 13:41:20 UTC (rev 78) +++ trunk/perl-flat/lib/FLAT/PFA.pm 2006-10-03 19:04:14 UTC (rev 79) @@ -205,7 +205,6 @@ if (!exists($NEW{$currentid})) {$NEW{$currentid} = $result->add_states(1)}; if (!exists($NEW{$nextid})) {$NEW{$nextid} = $result->add_states(1) }; $result->add_transition($NEW{$currentid},$NEW{$nextid},''); - print STDERR "$currentid ($NEW{$currentid}) on '$symbol' -> $nextid ($NEW{$nextid})"; } } } else { @@ -221,7 +220,6 @@ if (!exists($NEW{$currentid})) {$NEW{$currentid} = $result->add_states(1)}; if (!exists($NEW{$nextid})) {$NEW{$nextid} = $result->add_states(1) }; $result->add_transition($NEW{$currentid},$NEW{$nextid},$symbol); - print STDERR "$currentid ($NEW{$currentid}) on '$symbol' -> $nextid ($NEW{$nextid})"; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2006-09-27 03:38:22
|
Revision: 74 http://svn.sourceforge.net/perl-flat/?rev=74&view=rev Author: estrabd Date: 2006-09-26 20:38:17 -0700 (Tue, 26 Sep 2006) Log Message: ----------- added NFA->as_gdl, which outputs to the graph description language; sub routine basically identical to as_graphviz, but with different formatting Modified Paths: -------------- trunk/perl-flat/TODO trunk/perl-flat/dev-scripts/pregex-to-pfa.pl trunk/perl-flat/lib/FLAT/NFA.pm trunk/perl-flat/lib/FLAT/PFA.pm Modified: trunk/perl-flat/TODO =================================================================== --- trunk/perl-flat/TODO 2006-09-26 23:27:06 UTC (rev 73) +++ trunk/perl-flat/TODO 2006-09-27 03:38:17 UTC (rev 74) @@ -10,4 +10,4 @@ input and output options and formats - +look at creating a 'drop in' regex/pregex parser using the custom recdesc one build for FLAT::Legacy Modified: trunk/perl-flat/dev-scripts/pregex-to-pfa.pl =================================================================== --- trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-09-26 23:27:06 UTC (rev 73) +++ trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-09-27 03:38:17 UTC (rev 74) @@ -11,10 +11,11 @@ my $PFA = $PRE->as_pfa(); +my $gdl = $PFA->as_gdl; my $graphviz = $PFA->as_graphviz; my $summary = $PFA->as_summary; -print "$summary\n"; +print "$gdl\n"; open my $fh, "|-", "circo -Tpng -o output.png" or die "Couldn't run graphviz: $!\n"; Modified: trunk/perl-flat/lib/FLAT/NFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/NFA.pm 2006-09-26 23:27:06 UTC (rev 73) +++ trunk/perl-flat/lib/FLAT/NFA.pm 2006-09-27 03:38:17 UTC (rev 74) @@ -222,8 +222,36 @@ $self->add_transition($trash, $trash, $self->alphabet); } -############ +############ Formatted output + +# Graph Description Language, aiSee, etc +sub as_gdl { + my $self = shift; + + my @states = map { + sprintf qq{node: { title:"%s" shape:circle borderstyle: %s}\n}, + $_, + ($self->is_accepting($_) ? "double bordercolor: red" : "solid") + } $self->get_states; + + my @trans; + for my $s1 ($self->get_states) { + for my $s2 ($self->get_states) { + my $t = $self->get_transition($s1, $s2); + + if (defined $t) { + push @trans, sprintf qq[edge: { source: "%s" target: "%s" label: "%s" arrowstyle: line }\n], + $s1, $s2, $t->as_string; + } + }} + + return sprintf "graph: {\ndisplay_edge_labels: yes\n\n%s\n%s}\n", + join("", @states), + join("", @trans); +} + +# Graphviz: dot, etc sub as_graphviz { my $self = shift; Modified: trunk/perl-flat/lib/FLAT/PFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/PFA.pm 2006-09-26 23:27:06 UTC (rev 73) +++ trunk/perl-flat/lib/FLAT/PFA.pm 2006-09-27 03:38:17 UTC (rev 74) @@ -193,8 +193,9 @@ # } #1. make sure psuedo code is correct -#2. implement it, including any require initializations -#3. refine, refactor +#2 translate using the current PFA data structure +#3. implement it, including any require initializations +#4. refine, refactor sub as_nfa { my $self = shift; @@ -202,7 +203,7 @@ my %Dtran =(); # hash of serialized state names that have been searched # New NFA object reference my $result = FLAT::NFA->new(); - + return $result; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2006-09-26 23:27:10
|
Revision: 73 http://svn.sourceforge.net/perl-flat/?rev=73&view=rev Author: estrabd Date: 2006-09-26 16:27:06 -0700 (Tue, 26 Sep 2006) Log Message: ----------- .. Modified Paths: -------------- trunk/perl-flat/dev-scripts/regex-to-nfa.pl trunk/perl-flat/lib/FLAT/PFA.pm Modified: trunk/perl-flat/dev-scripts/regex-to-nfa.pl =================================================================== --- trunk/perl-flat/dev-scripts/regex-to-nfa.pl 2006-09-26 23:17:12 UTC (rev 72) +++ trunk/perl-flat/dev-scripts/regex-to-nfa.pl 2006-09-26 23:27:06 UTC (rev 73) @@ -10,7 +10,7 @@ my $nfa = FLAT::Regex->new($regex)->as_nfa; my $dot = $nfa->as_graphviz; -my $summary = $nfa->as_summary; +zmy $summary = $nfa->as_summary; print "$summary\n"; Modified: trunk/perl-flat/lib/FLAT/PFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/PFA.pm 2006-09-26 23:17:12 UTC (rev 72) +++ trunk/perl-flat/lib/FLAT/PFA.pm 2006-09-26 23:27:06 UTC (rev 73) @@ -165,8 +165,6 @@ $self; } -1; - # stretching my legs after a few months being gone ... see if the legacy conversion # can be modified to work @@ -174,7 +172,8 @@ # PSUEDO CODE # my @Dstates = get_starting(); # while (@Dstates) -# { my @T = @{pop (@Dstates)}; !!remember that states are made up of 1 or more nodes +# { 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) @@ -207,6 +206,8 @@ return $result; } +1; + __END__ =head1 NAME This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2006-09-26 23:17:15
|
Revision: 72 http://svn.sourceforge.net/perl-flat/?rev=72&view=rev Author: estrabd Date: 2006-09-26 16:17:12 -0700 (Tue, 26 Sep 2006) Log Message: ----------- fixed the spelling of complement Modified Paths: -------------- trunk/perl-flat-legacy/lib/FLAT/Legacy/FA/PFA.pm trunk/perl-flat-legacy/lib/FLAT/Legacy/FA.pm Modified: trunk/perl-flat-legacy/lib/FLAT/Legacy/FA/PFA.pm =================================================================== --- trunk/perl-flat-legacy/lib/FLAT/Legacy/FA/PFA.pm 2006-09-26 13:22:54 UTC (rev 71) +++ trunk/perl-flat-legacy/lib/FLAT/Legacy/FA/PFA.pm 2006-09-26 23:17:12 UTC (rev 72) @@ -226,7 +226,7 @@ # @next contains new, obviously push(@next,@new); # @next also contains @T - @tied - push(@next,$self->compliment(\@T,\@tied)); + push(@next,$self->complement(\@T,\@tied)); # see if the resulting state can be added to @Dstates my $state = $self->serialize_name(@next); if (!defined($Dtran{$state})) { @@ -240,7 +240,7 @@ if (defined($self->{_TRANSITIONS}{$node}{$symbol})) { my @new = $self->get_transition_on($node,$symbol); foreach my $new (@new) { - my @next = $self->compliment(\@T,[$node]); + my @next = $self->complement(\@T,[$node]); push(@next,$new); my $state = $self->serialize_name(@next); if (!defined($Dtran{$state})) { Modified: trunk/perl-flat-legacy/lib/FLAT/Legacy/FA.pm =================================================================== --- trunk/perl-flat-legacy/lib/FLAT/Legacy/FA.pm 2006-09-26 13:22:54 UTC (rev 71) +++ trunk/perl-flat-legacy/lib/FLAT/Legacy/FA.pm 2006-09-26 23:17:12 UTC (rev 72) @@ -235,7 +235,7 @@ close(FH); } -sub compliment { +sub complement { my $self = shift; my $set1 = shift; my $set2 = shift; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: notifies s. of c. c. <per...@li...> - 2006-09-12 14:37:16
|
Revision: 70 http://svn.sourceforge.net/perl-flat/?rev=70&view=rev Author: estrabd Date: 2006-09-12 07:37:09 -0700 (Tue, 12 Sep 2006) Log Message: ----------- ... Modified Paths: -------------- trunk/perl-flat/dev-scripts/pregex-to-pfa.pl trunk/perl-flat/lib/FLAT/PFA.pm Modified: trunk/perl-flat/dev-scripts/pregex-to-pfa.pl =================================================================== --- trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-08-08 03:36:18 UTC (rev 69) +++ trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-09-12 14:37:09 UTC (rev 70) @@ -12,13 +12,16 @@ my $PFA = $PRE->as_pfa(); -my $dot = $PFA->as_graphviz; +my $graphviz = $PFA->as_graphviz; my $summary = $PFA->as_summary; print "$summary\n"; -open my $fh, "|-", "dot -Tpng -o output.png" - or die "Couldn't run dot: $!\n"; +open my $fh, "|-", "circo -Tpng -o output.png" + or die "Couldn't run graphviz: $!\n"; -print $fh $dot; +print $fh $graphviz; 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-08-08 03:36:18 UTC (rev 69) +++ trunk/perl-flat/lib/FLAT/PFA.pm 2006-09-12 14:37:09 UTC (rev 70) @@ -167,15 +167,25 @@ 1; -# stretching my legs after a few months being gone.. +# stretching my legs after a few months being gone ... see if the legacy conversion +# can be modified to work sub as_nfa { my $self = shift; - - my $result = FLAT::DFA->new; - my %subset; - - $result; + my @Dstates = $self->get_states(); + my %Dtran =(); # hash of serialized state names that have been searched + # New NFA object reference + my $result = FLAT::NFA->new(); + + print Dumper(@Dstates); + +# while (@Dstates) { +# foreach ($self->alphabet()) { + +# } +# } + + return $result; } __END__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: notifies s. of c. c. <per...@li...> - 2006-08-08 03:36:23
|
Revision: 69 Author: estrabd Date: 2006-08-07 20:36:18 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/perl-flat/?rev=69&view=rev Log Message: ----------- figure this svn thing out! (hopefully)..onward to PFS->NFA! Modified Paths: -------------- trunk/perl-flat/lib/FLAT/NFA.pm trunk/perl-flat/lib/FLAT/PFA.pm Modified: trunk/perl-flat/lib/FLAT/NFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/NFA.pm 2006-05-28 03:39:53 UTC (rev 68) +++ trunk/perl-flat/lib/FLAT/NFA.pm 2006-08-08 03:36:18 UTC (rev 69) @@ -251,6 +251,7 @@ } sub _SET_ID { join "\0", sort { $a <=> $b } @_; } + sub as_dfa { my $self = shift; Modified: trunk/perl-flat/lib/FLAT/PFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/PFA.pm 2006-05-28 03:39:53 UTC (rev 68) +++ trunk/perl-flat/lib/FLAT/PFA.pm 2006-08-08 03:36:18 UTC (rev 69) @@ -47,9 +47,6 @@ # attack of the clones sub as_pfa { $_[0]->clone() } -# -sub as_nfa { $_[0]->clone() } - # set lambda symbol - temp fix for larger problem of special symbols # like epsilon and lambda sub set_lambda { @@ -170,6 +167,17 @@ 1; +# stretching my legs after a few months being gone.. + +sub as_nfa { + my $self = shift; + + my $result = FLAT::DFA->new; + my %subset; + + $result; + } + __END__ =head1 NAME This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <per...@li...> - 2006-05-28 03:39:59
|
Revision: 68 Author: estrabd Date: 2006-05-27 20:39:53 -0700 (Sat, 27 May 2006) ViewCVS: http://svn.sourceforge.net/perl-flat/?rev=68&view=rev Log Message: ----------- I think PRE->as_pfa is complete Modified Paths: -------------- trunk/perl-flat/lib/FLAT/PFA.pm Modified: trunk/perl-flat/lib/FLAT/PFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/PFA.pm 2006-05-24 05:53:43 UTC (rev 67) +++ trunk/perl-flat/lib/FLAT/PFA.pm 2006-05-28 03:39:53 UTC (rev 68) @@ -64,18 +64,27 @@ } # will implement the joining of two PFAs with lambda transitions -# BUG - need to fix +# need to fix sub shuffle { my @pfas = map { $_->as_pfa } @_; - my $result = $pfas[0]->clone; - my @newstate = ([ $result->get_states ]); - my @start = $result->get_starting; - + # iteratively add lambda pinch to all PFAs for (1 .. $#pfas) { - push @newstate, [ $result->_swallow( $pfas[$_] ) ]; + $result->_swallow( $pfas[$_] ); + my @starting = $result->get_starting(); + my @accepting = $result->get_accepting(); + $result->unset_starting(@starting); + $result->unset_accepting(@accepting); + my ($newstart, $newfinal) = $result->add_states(2); + $result->set_starting($newstart); + $result->set_accepting($newfinal); + foreach (@starting) { + $result->set_transition($newstart,$_,'#lambda'); + } + foreach (@accepting) { + $result->set_transition($_,$newfinal,'#lambda'); + } } - return $result; } @@ -84,8 +93,9 @@ my @pfas = map { $_->as_pfa } @_; my $result = $pfas[0]->clone; $result->_swallow($_) for @pfas[1 .. $#pfas]; - $result; -} + my ($newstart, $newfinal) = $result->add_states(2); + + } # joins two PFAs via concatenation - no change from NFA sub concat { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <per...@li...> - 2006-05-24 05:53:53
|
Revision: 67 Author: estrabd Date: 2006-05-23 22:53:43 -0700 (Tue, 23 May 2006) ViewCVS: http://svn.sourceforge.net/perl-flat/?rev=67&view=rev Log Message: ----------- made some adjustments - not there yet Modified Paths: -------------- trunk/perl-flat/dev-scripts/pregex-to-pfa.pl trunk/perl-flat/lib/FLAT/PFA.pm Modified: trunk/perl-flat/dev-scripts/pregex-to-pfa.pl =================================================================== --- trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-05-05 18:55:09 UTC (rev 66) +++ trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-05-24 05:53:43 UTC (rev 67) @@ -8,8 +8,17 @@ # This is mainly my test script for FLAT::FA::PFA.pm -my $PRE = FLAT::Regex::WithExtraOps->new('(a&b&c)*([cat]&[dog])'); +my $PRE = FLAT::Regex::WithExtraOps->new($ARGV[0]); my $PFA = $PRE->as_pfa(); -print Dumper($PFA); +my $dot = $PFA->as_graphviz; +my $summary = $PFA->as_summary; + +print "$summary\n"; + +open my $fh, "|-", "dot -Tpng -o output.png" + or die "Couldn't run dot: $!\n"; + +print $fh $dot; +close $fh; Modified: trunk/perl-flat/lib/FLAT/PFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/PFA.pm 2006-05-05 18:55:09 UTC (rev 66) +++ trunk/perl-flat/lib/FLAT/PFA.pm 2006-05-24 05:53:43 UTC (rev 67) @@ -47,6 +47,8 @@ # attack of the clones sub as_pfa { $_[0]->clone() } +# +sub as_nfa { $_[0]->clone() } # set lambda symbol - temp fix for larger problem of special symbols # like epsilon and lambda @@ -62,23 +64,18 @@ } # will implement the joining of two PFAs with lambda transitions +# BUG - need to fix sub shuffle { my @pfas = map { $_->as_pfa } @_; + my $result = $pfas[0]->clone; - $result->_swallow($_) for @pfas[1 .. $#pfas]; - my ($newstart, $newfinal) = $result->add_states(2); - my @starting = $result->get_starting; - my @accepting = $result->get_accepting; - $result->unset_starting(@starting); - $result->unset_accepting(@accepting); - $result->set_starting($newstart); - $result->set_accepting($newfinal); - foreach (@starting) { - $result->set_transition($newstart,$_,$result->get_lambda()); + my @newstate = ([ $result->get_states ]); + my @start = $result->get_starting; + + for (1 .. $#pfas) { + push @newstate, [ $result->_swallow( $pfas[$_] ) ]; } - foreach (@accepting) { - $result->set_transition($_,$newfinal,$result->get_lambda()); - } + return $result; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <per...@li...> - 2006-05-05 18:55:19
|
Revision: 66 Author: estrabd Date: 2006-05-05 11:55:09 -0700 (Fri, 05 May 2006) ViewCVS: http://svn.sourceforge.net/perl-flat/?rev=66&view=rev Log Message: ----------- PRE->to_pfa is now at a state ready for testing! Once I have verified that it is working correctly, I will move on to PFA->NFA Modified Paths: -------------- trunk/perl-flat/dev-scripts/pregex-to-pfa.pl trunk/perl-flat/lib/FLAT/PFA.pm trunk/perl-flat/lib/FLAT/Regex/WithExtraOps.pm Modified: trunk/perl-flat/dev-scripts/pregex-to-pfa.pl =================================================================== --- trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-04-26 16:32:41 UTC (rev 65) +++ trunk/perl-flat/dev-scripts/pregex-to-pfa.pl 2006-05-05 18:55:09 UTC (rev 66) @@ -4,11 +4,12 @@ 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 -my $PRE = FLAT::Regex::WithExtraOps->new('(ab+c*)&(a+b)*'); +my $PRE = FLAT::Regex::WithExtraOps->new('(a&b&c)*([cat]&[dog])'); my $PFA = $PRE->as_pfa(); -print $PRE->as_string; +print Dumper($PFA); Modified: trunk/perl-flat/lib/FLAT/PFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/PFA.pm 2006-04-26 16:32:41 UTC (rev 65) +++ trunk/perl-flat/lib/FLAT/PFA.pm 2006-05-05 18:55:09 UTC (rev 66) @@ -20,8 +20,6 @@ sub new { my $pkg = shift; my $self = $pkg->SUPER::new(@_); # <-- SUPER is FLAT::NFA - $self->{TIED} = []; # tracks tied nodes - $self->{ACTIVE_NODES} = []; # tracks active nodes - could be label like start and final $self->{LAMBDA} = '#lambda'; # special lambda symbol - used internally return $self; } @@ -30,7 +28,6 @@ sub singleton { my ($class, $char) = @_; my $pfa = $class->new; - if (not defined $char) { $pfa->add_states(1); $pfa->set_starting(0); @@ -66,13 +63,26 @@ # will implement the joining of two PFAs with lambda transitions sub shuffle { - croak "PFA::shuffle is not yet supported"; - # can't use _swallow, but might be able to use a modifed version of it... - # look at FLAT::Legacy + my @pfas = map { $_->as_pfa } @_; + my $result = $pfas[0]->clone; + $result->_swallow($_) for @pfas[1 .. $#pfas]; + my ($newstart, $newfinal) = $result->add_states(2); + my @starting = $result->get_starting; + my @accepting = $result->get_accepting; + $result->unset_starting(@starting); + $result->unset_accepting(@accepting); + $result->set_starting($newstart); + $result->set_accepting($newfinal); + foreach (@starting) { + $result->set_transition($newstart,$_,$result->get_lambda()); + } + foreach (@accepting) { + $result->set_transition($_,$newfinal,$result->get_lambda()); + } + return $result; } -<<<<<<< PFA.pm -# joins two PFAs in a union (or) +# joins two PFAs in a union (or) - no change from NFA sub union { my @pfas = map { $_->as_pfa } @_; my $result = $pfas[0]->clone; @@ -80,7 +90,7 @@ $result; } -# joins two PFAs via concatenation +# joins two PFAs via concatenation - no change from NFA sub concat { my @pfas = map { $_->as_pfa } @_; @@ -111,7 +121,7 @@ $result; } -# forms closure around a the given PFA +# forms closure around a the given PFA - no change from NFA sub kleene { my $result = $_[0]->clone; @@ -133,10 +143,22 @@ $result; } -# reversal should be like the transpose of the nodal transitoin -# matrix, but I still have to make sure + +# reverse - no change from NFA sub reverse { - croak "PFA::reverse is not yet supported"; + my $self = $_[0]->clone; + $self->_transpose; + + my @start = $self->get_starting; + my @final = $self->get_accepting; + + $self->unset_accepting( $self->get_states ); + $self->unset_starting( $self->get_states ); + + $self->set_accepting( @start ); + $self->set_starting( @final ); + + $self; } 1; Modified: trunk/perl-flat/lib/FLAT/Regex/WithExtraOps.pm =================================================================== --- trunk/perl-flat/lib/FLAT/Regex/WithExtraOps.pm 2006-04-26 16:32:41 UTC (rev 65) +++ trunk/perl-flat/lib/FLAT/Regex/WithExtraOps.pm 2006-05-05 18:55:09 UTC (rev 66) @@ -79,14 +79,16 @@ $pkg->new( @{ $item[1] } ); } -# Implement sub as_pfa { my $self = shift; + my @parts = map { $_->as_pfa } $self->members; + $parts[0]->shuffle( @parts[1..$#parts] ); } # Implement? sub reverse { my $self = shift; + croak "Not implemented for shuffled regexes"; } sub is_empty { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <per...@li...> - 2006-04-26 16:32:49
|
Revision: 65 Author: estrabd Date: 2006-04-26 09:32:41 -0700 (Wed, 26 Apr 2006) ViewCVS: http://svn.sourceforge.net/perl-flat/?rev=65&view=rev Log Message: ----------- testing notification Modified Paths: -------------- trunk/perl-flat/lib/FLAT/PFA.pm Modified: trunk/perl-flat/lib/FLAT/PFA.pm =================================================================== --- trunk/perl-flat/lib/FLAT/PFA.pm 2006-04-26 16:17:08 UTC (rev 64) +++ trunk/perl-flat/lib/FLAT/PFA.pm 2006-04-26 16:32:41 UTC (rev 65) @@ -5,15 +5,15 @@ use FLAT::Transition; -# + # Note: in a PFA, states are made up of active nodes. In this implementation, we have # decided to retain the functionality of the state functions in FA.pm, although the entities # being manipulated are technically nodes, not states. States are only explicitly tracked # once the PFA is serialized into an NFA. Therefore, the TRANS member of the PFA object is # the nodal transition function, gamma. The state transition function, delta, is not used # in anyway, but is derived out of the PFA->NFA conversion process. -# + # The new way of doing things eliminated from PFA.pm of FLAT::Legacy is the # need to explicitly track: start nodes, final nodes, symbols, and lambda & epsilon symbols, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |