[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make peg.el a built-in library?
From: |
Michael Heerdegen |
Subject: |
Re: Make peg.el a built-in library? |
Date: |
Sat, 09 Oct 2021 03:31:03 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> Hi all,
>
> In my on-again-off-again quest to not have to write text parsers myself,
> I was pointed towards the PEG library (in ELPA), which does pretty much
> exactly what I want (Parsing Expression Grammars).
I like the idea, and I have some remarks:
(1) Can we improve the introduction in the file header a bit? I would
add a link to the wikipedia page:
https://en.wikipedia.org/wiki/Parsing_expression_grammar
it explains some background.
And: one example could contain the (non-standard if you only know
regexps, but very educative) solution to the problem: "how do you jump
over arbitrary text preceding a match?" (the answer seems to be: "use
`or' and recursion", at least this is what I found out by myself after a
while).
(2) Would (replace E RPL) not be much more useful if it would be allowed
to pop from the stack? Something like (replace E [VAR...] -- REPL)
where REPL could use the VAR bindings? Background is of course that a
replacement may depend on intermediate parsing results.
(3) `(_ --) seems to produce an "Empty let body" compiler warning - can
we silence it?
(4) How hard would it be to parse regexps (or translate `rx' forms) into
an equivalent peg?
(5) We need to add a Game-like tutorial to PEGs called Peg-Man. Ok,
that one was only a joke.
WDYT?
Thanks,
Michael.
Re: Make peg.el a built-in library?, Stefan Monnier, 2021/10/09