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: Fri, 01 Oct 2021 23:57:56 -0400 Message-ID: References: <875yvtbbn3.fsf@ericabrahamsen.net> <83wno8u3uz.fsf@gnu.org> <87v93s9q4n.fsf@ericabrahamsen.net> <875yvafjr9.fsf@ericabrahamsen.net> <878rzdreem.fsf@alphapapa.net> <878rzcmvv4.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="7862"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Adam Porter , emacs-devel@gnu.org To: Eric Abrahamsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Oct 02 05:58:46 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 1mWWAf-0001rI-H5 for ged-emacs-devel@m.gmane-mx.org; Sat, 02 Oct 2021 05:58:45 +0200 Original-Received: from localhost ([::1]:51114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWWAe-0007z0-3O for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Oct 2021 23:58:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52216) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWWA2-0007KB-Lo for emacs-devel@gnu.org; Fri, 01 Oct 2021 23:58:06 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:5362) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWWA1-0008MI-1g for emacs-devel@gnu.org; Fri, 01 Oct 2021 23:58:06 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A70F28064E; Fri, 1 Oct 2021 23:58:03 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id AB0C080580; Fri, 1 Oct 2021 23:57:57 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1633147077; bh=SQFL5b1ggBqzdSoUqDsLkkeIbyDpd2xD6DeI3nU2cqU=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=LSJbywTpcDhmyVK/w9j4LYJsoTkM1mPHyXR8kY/5nbWpMntrqQSzQqQiBdEsDfPR0 xH3TJGpZlnKNXxvY8W3a+Hzg15O15QgANpOq61H9tXEGkgeLShZxx1ZL8c/WR+/Dl0 XLHZ4JR/4O6d2BLVZUqsmH8oy+uASDPNNaRZwCkttZMSyGC7COQe5sxwIPpDZIVs87 YIS6HuucZcOc2D5HfrNLABIo6zNSMfDqbwGijS5GNNnHsnKVZ2EJ+oy9h8g9rWF9xt 3v88Faeq9mM3tP9DpZDHV1qv4Ruiy4S7weFylKS6RS+aqmp6IoN3YFRvZpKSvJ4T6/ kp2x1T3T2go5w== Original-Received: from pastel (unknown [45.72.241.23]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 6573C1202C5; Fri, 1 Oct 2021 23:57:57 -0400 (EDT) In-Reply-To: <878rzcmvv4.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Fri, 01 Oct 2021 11:40:47 -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:276042 Archived-At: Eric Abrahamsen [2021-10-01 11:40:47] wrote: > Stefan Monnier writes: >>> In org-ql, the PEX is redefined at load time and/or run time, being >>> derived from search keywords that are defined by the package and >>> possibly by the user. So the PEX can't be defined in advance, at >>> compile time. So having to use `with-peg-rules' means having to use >>> `eval'. >> >> If the grammar changes radically at run time, based on external/user >> data there's probably no better way than via `eval` or similar (`load`, >> `byte-compile`, you name it). > > Can you explain why a function plus some sort of pre-compilation step > won't work? That "function plus precompilation step" would do the equivalent of `eval` ;-) > I suppose the `call' pex you mentioned up-thread could also ease things > a bit. Indeed, with it you can define a function like `peg-and` such that (peg-and (peg PEX1) (peg PEX2)) === (peg (and PEX1 PEX2)) but using such functions to build a PEG would result in substantially slower code (because it gets split into many small functions, thus increasing the function call overheads). Stefan