GNU bug report logs - #73188
PEG parser does not support full PEG grammar

Previous Next

Package: guile;

Reported by: Ekaitz Zarraga <ekaitz <at> elenq.tech>

Date: Wed, 11 Sep 2024 22:05:01 UTC

Severity: normal

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Ekaitz Zarraga <ekaitz <at> elenq.tech>
Cc: 73188 <at> debbugs.gnu.org
Subject: bug#73188: PEG parser does not support full PEG grammar
Date: Sun, 13 Oct 2024 22:29:39 +0200
Hi Ekaitz,

Ekaitz Zarraga <ekaitz <at> elenq.tech> skribis:

> This commit adds support for PEG as described in:
>
>     <https://bford.info/pub/lang/peg.pdf>

I would make this a comment below the ‘define-module’ form.

> It adds support for the missing features (comments, underscores in
> identifiers and escaping) while keeping the extensions (dashes in
> identifiers, < and <--).
>
> The naming system tries to be as close as possible to the one proposed
> in the paper.
>
> * module/ice-9/peg/string-peg.scm: Rewrite PEG parser.
> * test-suite/tests/peg.test: Fix import

Nice work!

Questions:

  1. Is the name change for lexical elements (camel case instead of
     lower-case + hyphens) user-visible?  I guess no but better be safe
     than sorry.

     I have a preference for lower-case + hyphens out of consistency
     with the rest of Scheme, but I can see how keeping the same names
     as in the reference material helps.

  2. Could you add tests for the missing features that this adds, and
     maybe extend ‘api-peg.texi’ accordingly too?

  3. You can choose to assign copyright to the FSF or to not do that¹.
     In the latter case, please add a copyright line for you where
     appropriate.

I’m really not a PEG expert though so I’d prefer more eyeballs here, but
I trust your judgment.

There are three (guix import *) modules that use (ice-9 peg) and that
come with tests.  It would be nice to check that those tests still pass
with the modified string-peg.scm.

Thanks!

Ludo’.

¹ https://lists.gnu.org/archive/html/guile-devel/2022-10/msg00008.html




This bug report was last modified 143 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.