[Top][All Lists]

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

Re: PEG Patches

From: Noah Lavine
Subject: Re: PEG Patches
Date: Thu, 31 Mar 2011 17:48:26 -0400

Hello again,

I was about to do this, and then I discovered that it wouldn't work,
because there are a few special case PEGs that don't make sense as
macros. Specifically, in the context of a PEG, we interpret strings as
matching themselves, and those can't be made into macros.

So I went ahead and implemented a simple way to extend
peg-sexp-compile. It turned out to be much less difficult than I was
afraid of.

The first attached patch adds the interface to (ice-9 peg codegen) and
changes most of the functions there to use it, and also adds some
documentation in the PEG Internals section. The second one updates
(ice-9 peg string-peg) to use it as well, and gets rid of
peg-extended-compile from peg.scm since it's no longer needed.

I wrote the patches on top of the last two that I sent, because those
included some cleanups that I wanted to keep.


On Tue, Mar 29, 2011 at 9:20 AM, Andy Wingo <address@hidden> wrote:
> On Tue 29 Mar 2011 14:47, Noah Lavine <address@hidden> writes:
>>> (define-peg-matcher and cg-and)
>> That's doable. But if we're going to choose what to do entirely based
>> on the first element of the list, then we could also just not define
>> peg-sexp-compile at all and make each of the code generation functions
>> into macros.
>> How does that sound?
> Good idea.  Sounds great to me!
> Andy
> --

Attachment: 0001-Extensible-PEG-Syntax.patch
Description: Binary data

Attachment: 0002-Update-String-PEGs.patch
Description: Binary data

reply via email to

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