Now that it seems that Parse::RecDescent and, ultimately, Parse::FastDescent, will be subsumed into the Perl 6 regex/grammar system, I've been thinking about how to implement P::RD directives such as <autotree>, <score> and <leftop>; or features such as tracing.
I've really only thought about <leftop>, but am not sure if those thoughts are even going in the right direction, so please correct anything that looks like nonsense. Suppose you want a <leftop> assertion that works like the <leftop> directive in P::RD, so that <leftop atom, and, atom> becomes the same as <atom> (and <atom>)* There could be a two-arg version of <leftop> that assumes the rightop is the same as the leftop: <leftop atom, and> I'm not sure of the syntax to invoke rules that take more than one argument. Maybe it would be <leftop(atom, and, atom)> <leftop(atom, and)> (I hope I'm right in assuming that arguments to rules aren't evaluated but rather passed in literally like a kind of macro mechanism, otherwise I don't understand how rule not ($rx) { <!$rx> } is supposed to work.) Now, could you just do rule leftop ($leftop, $op) { <$leftop> [$op <$leftop>]* } rule leftop ($leftop, $op, $rightop) { <$leftop> [$op <$rightop>]* } That is, if there are multimethods. If not, i suppose we could have rule leftop is multimethod($leftop, $op) { ... } rule leftop is multimethod($leftop, $op, $rightop) { ... } Does that look like valid Perl 6 code (it's my first try to be honest) or is it just nonsense? Thanks Marcel -- We are Perl. Your table will be assimilated. Your waiter will adapt to service us. Surrender your beer. Resistance is futile. -- London.pm strategy aka "embrace and extend" aka "mark and sweep"