From: Stefan Monnier via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: help-gnu-emacs@gnu.org
Subject: Re: How are regexen implemented in Emacs?
Date: Thu, 15 Dec 2022 11:46:13 -0500 [thread overview]
Message-ID: <jwvmt7o7hak.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: Y5eIjWI/wzwd+EsU@tuxteam.de
> Nitpick: The Emacs regexp engine is a FA based one, but a DFA,
> not a NFA (the famous Thompson NFA).
No, it's definitely not DFA because it uses a stack to implement
the backtracking.
It's usually considered to be an NFA that's processed via backtracking
rather than via "parallel execution" as "Thompson's NFA" does.
[ For Haskeller's out there, it's a bit like the difference between the
Cont monad and the List monad with the added twist that "Thompson's
NFA" replaces the List monad with a "Set monad", which is what changes
its complexity. ]
> 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,
It's not hard to implement, no.
At least not until you consider things like *? and backreferences.
Stefan
next prev parent reply other threads:[~2022-12-15 16:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 17:15 How are regexen implemented in Emacs? Marcin Borkowski
2022-12-12 18:16 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-12-12 19:09 ` Marcin Borkowski
2022-12-12 19:17 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-12-12 20:31 ` Marcin Borkowski
2022-12-12 21:19 ` Stefan Monnier
2022-12-13 5:01 ` tomas
2022-12-13 16:16 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-12-15 5:22 ` Emanuel Berg
2022-12-16 17:39 ` Akib Azmain Turja
2022-12-17 0:31 ` Emanuel Berg
2022-12-18 0:54 ` Jean Louis
2022-12-19 20:31 ` Emanuel Berg
2022-12-12 20:01 ` tomas
2022-12-12 20:32 ` Marcin Borkowski
2022-12-12 21:24 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-12-15 5:18 ` Emanuel Berg
2022-12-15 13:38 ` tomas
2022-12-15 16:46 ` Stefan Monnier via Users list for the GNU Emacs text editor [this message]
2022-12-15 17:56 ` tomas
2022-12-17 0:13 ` Emanuel Berg
2022-12-15 3:45 ` Emanuel Berg
2022-12-15 13:22 ` tomas
2022-12-15 3:41 ` Emanuel Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvmt7o7hak.fsf-monnier+emacs@gnu.org \
--to=help-gnu-emacs@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).