From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Make peg.el a built-in library? Date: Sat, 09 Oct 2021 23:43:28 -0400 Message-ID: References: <875yvtbbn3.fsf@ericabrahamsen.net> <87a6jjc7c8.fsf@web.de> <87v926w3bs.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21720"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Michael Heerdegen , emacs-devel@gnu.org To: Eric Abrahamsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Oct 10 05:44:28 2021 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 1mZPlC-0005OQ-T5 for ged-emacs-devel@m.gmane-mx.org; Sun, 10 Oct 2021 05:44:27 +0200 Original-Received: from localhost ([::1]:36106 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZPlB-0001Lq-NP for ged-emacs-devel@m.gmane-mx.org; Sat, 09 Oct 2021 23:44:25 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZPkM-0000gk-96 for emacs-devel@gnu.org; Sat, 09 Oct 2021 23:43:34 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:42317) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZPkK-0004M1-Co for emacs-devel@gnu.org; Sat, 09 Oct 2021 23:43:33 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2BBBA80531; Sat, 9 Oct 2021 23:43:31 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 08CA1800C0; Sat, 9 Oct 2021 23:43:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1633837410; bh=lI6Wzp/SD+pb3/7Y9OdWm8Gb1R2XjilndYUK5vvoZVI=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=hrHnaZ6z17VJCMoHBpONQB441SS1aL2Dy+xIiNBNEXmSmrG0Lgf76/RmWMQZuIT0G cSt+t3A6SNqu6vCBcFFu8N1yljAyx4F4LnW32tCvwWCJdd0m+g1Gv1J8kHqHdlrUD8 U4Z7gQFG0HHOCD7R+W7nnuPA02CYeXyeGDZWwohBb9t7ul9Lfh5fs1t2x3VczC+0vQ ODbhhIXLnFa+qg0umj6NY32kqmMIcJ6eanxNvbUL+Sy8dIr/Qgt5weoHob50yenqYy snnLE8rrCXC9WEQmHLgm2/XqGAE+0NYedsD2AVr7+7+QykYfEAELw5TbHUYF9zzRdm HKx12pcaep6cQ== Original-Received: from milanesa (unknown [45.72.241.23]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C1E111203C5; Sat, 9 Oct 2021 23:43:29 -0400 (EDT) In-Reply-To: <87v926w3bs.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sat, 09 Oct 2021 09:49:43 -0700") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.devel:276632 Archived-At: >> (4) How hard would it be to parse regexps (or translate `rx' forms) into >> an equivalent peg? > I had this idea as well -- we've already got "regexps that look like > forms", it seems like it would be a natural to integrate this with rx. > One thing we're not short of here is new ideas for code, but I do think > this would make a lot of sense. I think turning a regexp into a PEG should be easy, but at one condition: you shouldn't expect that PEG to be *equivalent* to the regexp. E.g. when matching (string-match "\\(ab\\|a)bc" "abc") the "natural" PEG for that regexp will fail to match (because it will see a success to match "ab" and will hence just skip the "a" alternative). Correctly matching regexps requires a deeper form of backtracking than provided by PEGs. Stefan