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: Stefan Monnier
Subject: Re: Make peg.el a built-in library?
Date: Sun, 10 Oct 2021 09:56:09 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

>> Is it practically possible to transform a regexp into a really
>> equivalent PEG, or is it too difficult, or would the resulting PEG just
>> be too large or inefficient?
> The LPEG people wrote a paper[*] about this problem.  But I haven't read

This is similar to turning the regexp into an NFA and then using the PEG
backtracking to run the NFA.  Our regexp engine tries to remove some
simple forms of backtracking (e.g. for regexps like "\\(.foo\\)*\nbar"
because \n and . are mutually exclusive).  This significantly reduces
the amount of stack use.  We could/should perform similar optimizations
in `peg.el`.


        Stefan





reply via email to

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