emacs-devel
[Top][All Lists]
Advanced

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

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


From: Eduardo Ochs
Subject: Re: [PATCH] Re: Make peg.el a built-in library?
Date: Sun, 5 Feb 2023 12:41:10 -0300

On Sun, 5 Feb 2023 at 09:10, Ihor Radchenko <yantar92@posteo.net> wrote:
>
> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
> > Ihor Radchenko <yantar92@posteo.net> writes:
> >
> >> I am wondering if we may instead just support traditional regexps as an
> >> extra PEG construct. Considering that regexp support is anyway built-in,
> >> why not?
> >
> > Dunno.  I wrote the translator for academic interest and for
> > learning.
> >
> > AFAIR not all Emacs regexp features work in PEGs - backrefs for example.
> > Or match data handling.
>
> Sure. But if we make Emacs regexp a valid PEG construct, they will work.
> It is the whole point.

I played a bit with peg.el some time ago - it is very elegant and it's
very easy to inspect how it does things, but it is much slower than
Lua's LPEG. I'm now using this to write my parsers:

  https://github.com/edubart/lpegrex
  https://github.com/edubart/lpegrex/blob/main/parsers/lua.lua

The second link above is an example - a parser for Lua written in
Lpegrex.

I'm starting to use this thing, that lets me run a Lua interpreter
inside Emacs as a module,

  https://github.com/edrx/emlua/#introduction

to call lpegrex parsers to parse parts of Emacs buffers. The result -
let me call it lpegrex+emlua - is very fragile because I'm too bad &
lazy with C programming to implement better error handling in emlua,
but if anyone else wants to play with lpegrex+emlua I can create a
page with instructions...

  Cheers,
    Eduardo Ochs
    http://anggtwu.net/#eev
    http://anggtwu.net/eepitch.html



reply via email to

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