guile-devel
[Top][All Lists]
Advanced

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

Re: More PEG


From: Ludovic Courtès
Subject: Re: More PEG
Date: Fri, 09 Sep 2011 22:51:04 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Hi Noah,

Noah Lavine <address@hidden> skribis:

> It looks to me like the last thing needed before the peg branch can be
> used is to change some of the S-expression representations of the
> components. Here are the five that I think need changing, taken from
> the manual, with suggested replacements.

This looks like interesting stuff!

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

[...]

> There's something I'm still a little unsure about, though. It's
> possible to get deeply nested S-expressions, like '(+ (and (* "a")
> "b")). Since +, * and ? only ever take one argument, it is possible to
> shorten such a list by letting people merge those elements into the
> next item, like this: '(+ and (* "a") "b").

I would rather keep it simple and avoid shortcuts that may end up being
confusing.

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.

Thanks,
Ludo’.




reply via email to

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