On Thu, Dec 09, 2010 at 12:36:09PM -0800, Gordon Tisher wrote:
> On 09/12/2010 12:01 PM, Alan Post wrote:
> > I'm working on my PEG parser, in particular the interface between
> > the parse tree and the code one can attach to productions that
> > are executed on a successful parse.
> > 
> > I've arranged for the two predicate operations, & and !, to not add
> > any output to the parse tree.  That means that the following
> > production:
> > 
> >   rule <- &a !b "c"
> 
> This will never match anything, unless a == "c"
> 

It's an example showing the essential idea, I understand it looks
likely to be wrong.


> If you want to select only certain results from a sequence, use
> variables to capture their results and an action to return the result of
> any desired function of their values:
> 
>   Rule <- &a:x "c":y -> f(x,y)
> 

Does your example imply:

   Rule <- &a "c" -> f()

That is, if no rules are tagged, there are no arguments to f?

Des it also imply:

   Rule <- &a:y "c":x -> f(x,y)

Namely, that order of tagged rules doesn't matter, and that the
signature for |f| accepts keyword arguments rather than positional
arguments?

Thank you,

-Alan
-- 
.i ko djuno fi le do sevzi

_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to