2006/7/5, Joshua Gatcomb <[EMAIL PROTECTED]>:
I have not had a chance to look at Flavio's links yet. Since no one who actually knows rules seemed to be inspired to write an example for me - I will *eventually* figure it out on my own and post back to the list as an FYI.
Here is a simple one that handles '+' and '*' - it could be simplified a bit, but this one works for me: --- use Data::Dumper; use strict; use Pugs::Compiler::Token; use Pugs::Runtime::Match::Ratchet; use base 'Pugs::Grammar::Base'; Pugs::Compiler::Token->install( 'mul',' (<alnum>+) [ \\* <mul> { return ( $/[0]()*$/{mul}() ) } | <\'\'> ] ' ); Pugs::Compiler::Token->install( 'sum',' <mul> [ \\+ <sum> { return $/{mul}()+$/{sum}() } | <\'\'> { return $/{mul}() } ] ' ); my $s = shift; my $match = main->sum( $s ); print $match->(); --- - Flavio S. Glock