From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: Make peg.el a built-in library? Date: Tue, 08 Nov 2022 11:42:54 -0800 Message-ID: <87wn85z0zl.fsf@ericabrahamsen.net> References: <875yvtbbn3.fsf@ericabrahamsen.net> <877d07a16u.fsf@localhost> <87tu3asg2r.fsf@ericabrahamsen.net> <87edud25ov.fsf@localhost> <87a6511ku0.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="9391"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Cancel-Lock: sha1:xb8RzXGMnfln2XZWJCCylxorB/8= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 08 21:19:34 2022 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 1osV4G-0002EN-21 for ged-emacs-devel@m.gmane-mx.org; Tue, 08 Nov 2022 21:19:32 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1osV3m-0002jV-Ci; Tue, 08 Nov 2022 15:19:02 -0500 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 1osUWy-0004zi-Nw for emacs-devel@gnu.org; Tue, 08 Nov 2022 14:45:08 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1osUWx-0003Qr-C0 for emacs-devel@gnu.org; Tue, 08 Nov 2022 14:45:08 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1osUWt-0007Me-PW for emacs-devel@gnu.org; Tue, 08 Nov 2022 20:45:03 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 08 Nov 2022 15:19:00 -0500 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:299366 Archived-At: writes: > On Tue, Nov 08, 2022 at 08:18:15AM -0800, Eric Abrahamsen wrote: >> Ihor Radchenko writes: >> >> > Eric Abrahamsen writes: >> > >> >>> Is there any progress merging peg.el to Emacs? >> >>> I do not see any obvious blockers in the discussion, but the merge never >> >>> happened? > > [...] > >> > As the comment in peg.el states, the definitions are adapted from the >> > original PEG paper [...] > >> This is what I was saying in my original message, though: if peg.el is >> going to go into core, it probably needs more/better docs than code >> comments and "read this paper". Its likely users will be Elisp library >> authors like me, who are just trying to free themselves from regexp hell >> and want a relatively straightforward alternative. > > Yes. Coming from regexp they are deceivingly similar but frustratingly > different. > > The best way I found to wrap my head around them is that they are a > fancy notation for a recursive descent parser. Thus slightly more > powerful than regexps, but slightly less than a full YACC (i.e. LALR > or thereabouts). > > What is attractive about them is that one can do "full" parsers > (as long as your grammar is roughly LL(k)) without having to build > two storey buildings. I guess it takes some practice, though (I > haven't). > > I think comparing them to treesitter is a category error. Okay, this is all sounding good. I'm going to read the paper, try to get my head around all this, and write some docs for peg.el.