[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#73188: PEG parser does not support full PEG grammar
From: |
Ekaitz Zarraga |
Subject: |
bug#73188: PEG parser does not support full PEG grammar |
Date: |
Mon, 14 Oct 2024 16:00:02 +0200 |
Hi,
So I reviewed the suggestions and this what I have:
- Added the comment
- Added my copyright line
- Nothing in Guix is affected by the changes proposed here, because
there's no use of `string-peg` and I didn't change how the S-Expression
based PEG works.
- The changes applied here only affect to the PEG written as PEG strings
and their processing, which was introduced in the documentation as "read
the wikipedia", but our PEG definition wasn't implementing the real PEG
explained in that wikipedia link. Our documentation claimed that we were
able to do things we were not able to do.
- I added a link to the paper we are following below the link to the
wikipedia page just in case, to let our users know exactly what does our
PEG support. The paper says:
Literals and character classes can contain C-like escape codes
That should be enough for anyone. Also we support `-` in identifiers,
but our documentation already said that. I replaced the description of
what normal PEG supports. Our docs said PEG only supported alphabetic
characters but it has never been true, the paper explains PEG supports
alpha, numeric and `_`, but the numeric cannot be the first character
(like C identifiers).
- What it is true is if people were using `peg-as-peg` for their things,
which isn't even exported by the module, their code would have problems.
But we can't predict that.
- In summary, what I implemented here is a PEG string to PEG Sexp
compiler. So it shouldn't affect anyone that uses the PEG Sexp directly
and if I did my work properly it shouldn't affect those that used their
PEG patterns in strings either, because I only made it work closely to
what the paper said, adding a couple of missing features.
EXTRA:
I rebased the support for the `not-in-range` part, that does touch the
PEG sexp part, but only adds more functionality without affecting
anything that already existed.
In following days I'll review Error reporting and captures that were
added in a different thread in guile-devel and see if we can integrate
everything to create a production ready PEG parser.
Thanks!
Ekaitz
I attached both patches.
v3-0001-PEG-Add-full-support-for-PEG-some-extensions.patch
Description: Text Data
v3-0002-PEG-Add-support-for-not-in-range-and.patch
Description: Text Data