emacs-devel
[Top][All Lists]
Advanced

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

Re: Make peg.el a built-in library?


From: Eric Abrahamsen
Subject: Re: Make peg.el a built-in library?
Date: Sun, 26 Sep 2021 08:06:00 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Augusto Stoffel <arstoffel@gmail.com> writes:

> I think it would be really cool to have PEGs built into Emacs.  Things
> like json.el could be simplified by at least (log10 2) orders of
> magnitude with PEGs.  Whatever the use case of `rx' is, PEGs are
> probably the "real" solution.
>
> But I suspect this would only take traction with a fast and robust C
> implementation like Lua's LPEG (see below for a reason).

I wonder if it would make sense to adopt this elisp library for now, see
if people use it (or want to use it but complain about speed), and
consider translating to C if they do?

The elisp version has generic methods for `peg-normalize' (and
`peg--macroexpand', though I guess that's private) which would allow
library authors to write new peg expressions. We'd lose that with C,
though I suppose speed vs extensibility is always the tradeoff with
C vs Elisp.

In a previous message I complained a little bit about the entry-points
to PEG as it stands now -- they're all macros. Maybe if we were thinking
in terms of a future C translation, we could narrow the API down a
little and lock it down, and discourage authors from using anything that
wouldn't be made available by the future version.

Eric




reply via email to

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