guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: More PEG


From: Noah Lavine
Subject: Re: More PEG
Date: Fri, 9 Sep 2011 17:05:06 -0400

Hello,

> The syntactic changes you propose all make sense to me, FWIW.

Great! Then I will push an implementation soon unless someone else objects.

> A more general question about PEG: how do you bind a variable to the
> result of a pattern?  For instance, if you want the result of (* "a") to
> be bound to variable X–just like (match '(1 2 3) ((a _ ...) a)) binds A
> to 1.

We currently don't have that ability. I can see that it would be very
convenient, though, so maybe we should have it.

Right now I think you could get the same thing by running match on the
output of the peg - something like

(match (peg:tree (peg-parse <pattern> <tree>))
  ((list-of-as) ...)).

Do you think that's a good enough interface, or should the binding
happen directly? I can see that it would be more efficient if we
didn't box up the results in a structure first.

Thanks,
Noah



reply via email to

[Prev in Thread] Current Thread [Next in Thread]