help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How are regexen implemented in Emacs?


From: Marcin Borkowski
Subject: Re: How are regexen implemented in Emacs?
Date: Mon, 12 Dec 2022 21:32:25 +0100
User-agent: mu4e 1.1.0; emacs 29.0.50

On 2022-12-12, at 21:01, tomas@tuxteam.de wrote:

> On Mon, Dec 12, 2022 at 08:09:42PM +0100, Marcin Borkowski wrote:
>>
>> On 2022-12-12, at 19:16, Stefan Monnier via Users list for the GNU Emacs 
>> text editor <help-gnu-emacs@gnu.org> wrote:
>>
>> >> https://www.gnu.org/software/emacs/manual/html_node/elisp/Regexp-Problems.html
>> >> and started to wonder if the hints there mean that Emacs has a "naive",
>> >> backtracking regex engine or a FA-based one?
>> >
>> > Naive!
>>
>> And what are the reasons?  Out of curiosity: would implementing
>> a FA-based one be a very big undertaking?  (And no, I won't do it, if
>> only because I don't know C.)
>
> Nitpick: The Emacs regexp engine is a FA based one, but a DFA,
> not a NFA (the famous Thompson NFA).
>
> NFAs seem to be quite the beast, judging by how few implementations
> are out there. I don't even know how easy it is to implement, e.g.
> capture or (gasp!) back references,

Very interesting.  Re: back references, are even "regexen" with back
references still real regular expressions?

Best,

-- 
Marcin Borkowski
http://mbork.pl



reply via email to

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