From: notifies s. of c. c. <per...@li...> - 2007-02-27 05:11:52
|
Revision: 109 http://svn.sourceforge.net/perl-flat/?rev=109&view=rev Author: estrabd Date: 2007-02-26 21:11:54 -0800 (Mon, 26 Feb 2007) Log Message: ----------- more playing with script - need to put it into module code...also, need to figure out iterative thing and cycle thing Modified Paths: -------------- trunk/perl-flat/dev-scripts/bdetest.pl Modified: trunk/perl-flat/dev-scripts/bdetest.pl =================================================================== --- trunk/perl-flat/dev-scripts/bdetest.pl 2007-02-27 03:01:37 UTC (rev 108) +++ trunk/perl-flat/dev-scripts/bdetest.pl 2007-02-27 05:11:54 UTC (rev 109) @@ -5,8 +5,35 @@ use FLAT::DFA; use FLAT::Regex::WithExtraOps; -my $dfa = FLAT::Regex::WithExtraOps->new($ARGV[0])->as_pfa->as_nfa->as_dfa->as_min_dfa->trim_sinks; +# fucking A! +# perl bdetest.pl "a&b&c&d" will give you all permutations ... once the transformations are done. +# because it takes so darn long to do transformations, it it might be useful to have a native +# interface to dumping a "frozen" DFA object to file...time to investigate +print STDERR <<END; + + This example includes the serialization of the DFA object, + so if the file exists, it will not go through the transformation again; + In a basic sense, this is an example of compressing data - compare the + size of the serialized object with a text file containing all strings stored + in the DFA. The "compression" is even more extreme if you compare the size + of the output'd text with the size of the actual regular expression. +END + +my $dfa; +#example: +use Storable; + +mkdir "dat" if (! -e "dat"); + +if (!-e "dat/$ARGV[0].dat") { + $dfa = FLAT::Regex::WithExtraOps->new($ARGV[0])->as_pfa->as_nfa->as_dfa->as_min_dfa->trim_sinks; + store $dfa, "dat/$ARGV[0].dat"; +} else { + print STDERR "dat/$ARGV[0].dat found.."; + $dfa = retrieve "dat/$ARGV[0].dat"; +} + my %nodes = $dfa->as_node_list(); my %dflabel = (); # "global" lookup table for dflable This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |