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: Stefan Monnier
Subject: Re: How are regexen implemented in Emacs?
Date: Tue, 13 Dec 2022 11:16:12 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> Perl does the latter. That has saved my bacon from time to time.
> So that seems possible with a backtracker, too.  Don't ask me how,
> though :-)

Indeed, it's not more difficulty to allow to run ELisp/Perl
code in the middle of the backtracking match than a non-backtracking
one, but the difference is in the number of times the ELisp/Perl code
may need to be run, which changes the performance profile (and hence
the potential use-cases) significantly.


        Stefan


PS: Regarding non-backtracking matchers are backreferences, most of the
uses of backreferences I'm familiar with *can* be implemented without
backtracking because the subgroup to which the backref points has only
one possible way to match.  It won't handle cases like
`diff-merge-strings`, but it's still an important subset of cases.




reply via email to

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