From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: prior work on non-backtracking regex engine? Date: Mon, 08 Apr 2024 16:13:46 +0300 Message-ID: <86v84sxaid.fsf@gnu.org> References: <3a9IKoS2YLqJYosdfpFVdq8ashG0LPPJdB-ugdUgJEqM6-O3RWFeCu01FUPYBsp87xchkX-z1PRlNqJQm8ge_h3v0ziCWcME2fx-6PW-UP4=@hypnicjerk.ai> <87il1qw9i9.fsf@localhost> <8eHWNAHASGpm2Qhs7mldB0VTdFaRW0NZJWi9ppNiCPZQ-QO8E7YLUXzJfT7LXYe1mTnwFGACouy7YroB8qsCFDbRuWYHr2gvOTagQY3TW7w=@hypnicjerk.ai> <87edbgt5by.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24033"; mail-complaints-to="usenet@ciao.gmane.io" Cc: dmcc2@hypnicjerk.ai, yantar92@posteo.net, emacs-devel@gnu.org To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Apr 08 15:14:57 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rtops-0005yL-Qs for ged-emacs-devel@m.gmane-mx.org; Mon, 08 Apr 2024 15:14:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtop7-0004Am-MR; Mon, 08 Apr 2024 09:14:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtoow-0004AM-Dg for emacs-devel@gnu.org; Mon, 08 Apr 2024 09:13:59 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rtoot-0000Jg-EQ; Mon, 08 Apr 2024 09:13:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GqywxhLrJWzXDkGGAGFrjvC3U3Jxc0J9ZPQpCx9/Sbs=; b=OycTzz31NG9v i2Y3GGDPd58v47QP3ZVcq9Ufqjm7g6Z0vutB+qKJAM/I9rrplUp6nRXbr+coD+3v7NeLJK0/ArlrB P8BuoY5UENtRhoJa9nWy3BNhzgy77CrZ1KA1qFbSo15ySVrHQkMT8dqo/GuF5WbuakrffEgxzU6bd yLb6tzMgC5GpaZ8ZLZjaXQpPmc5CTpFVn0XtttXQrLXYlM5RZtP5AS1RTGHpn1gVbLL5RZ2rW3lbT aYKy5xGjJlP7/lncAoO1zmVQLZhPMDbbBKqSPlKe9KarphbuTU9gM1hPusGq+naADjFRjmSJ4jMLW wtgxCjMDG9rHAV/me0euiA==; In-Reply-To: <87edbgt5by.fsf@gmail.com> (message from Helmut Eller on Mon, 08 Apr 2024 14:19:13 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:317606 Archived-At: > From: Helmut Eller > Cc: Ihor Radchenko , "emacs-devel@gnu.org" > > Date: Mon, 08 Apr 2024 14:19:13 +0200 > > On Sun, Apr 07 2024, Danny McClanahan wrote: > > > And I was also *super* > > pleased to see that regex-emacs.h itself doesn't expose any dependency > > on the gap buffer or other internal emacs representations (except > > regarding multibyte encoding). So in my amateur evaluation, emacs > > actually seems very well-placed to take advantage of high-performance > > regex engine techniques without any big structural changes. > > What's the history of regex-emacs.h? It seems like in the past it was > regex.h from Gnulib. That would explain why the regex engine is > relatively well decoupled from the rest. But it also leads to the > question: why does Emacs no longer use Gnulib's regex engine? The Gnulib regex is basically the glibc regex. Why Emacs cannot use the glibc code was discussed here (among other places): https://lists.gnu.org/archive/html/emacs-devel/2002-04/msg00084.html > My guess is that it has something to do with the way Emacs's performs > case-insensitive matches. No, it's because Emacs has some unique requirements for regular expressions. > So does somebody know the details why Gnulib and Emacs went separate > ways in the past? Basically, because no one was interested in merging them (which would include some macro-ization, so that Emacs could have the features it needs, while other programs could have those special features compile to trivial code). regex-emacs.c started that way, but when glibc and Gnulib switched to a new engine, they never bothered to keep the Emacs-specific features we had in the original code.