From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter maturity Date: Fri, 27 Dec 2024 09:24:40 -0500 Message-ID: <0883EB00-3BB2-4BC8-95D1-45F4497C0526@dancol.org> References: <1ed88fca-788a-fe9f-b6c8-edb2f49751c9@mavit.org.uk> <67428b3d.c80a0220.2f3036.adbdSMTPIN_ADDED_BROKEN@mx.google.com> <86ldwdm7xg.fsf@gnu.org> <6765355b.c80a0220.1a6b24.3117SMTPIN_ADDED_BROKEN@mx.google.com> <00554790-CACA-4233-8846-9E091CF1F7AA@gmail.com> <86msgl2red.fsf@gnu.org> <87o710sr7y.fsf@debian-hx90.lan> <8734i9tmze.fsf@posteo.net> <86plldwb7w.fsf@gnu.org> <87ttapryxr.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4708"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: K-9 Mail for Android Cc: emacs-devel@gnu.org, Eli Zaretskii , rms@gnu.org, manphiz@gmail.com To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 27 15:25:30 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 1tRBHM-00015M-Rx for ged-emacs-devel@m.gmane-mx.org; Fri, 27 Dec 2024 15:25:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRBGy-0006KR-GN; Fri, 27 Dec 2024 09:25:05 -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 1tRBGq-0006Jp-3w for emacs-devel@gnu.org; Fri, 27 Dec 2024 09:24:57 -0500 Original-Received: from dancol.org ([2600:3c01:e000:3d8::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRBGo-0003YL-5L; Fri, 27 Dec 2024 09:24:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: References:In-Reply-To:Subject:CC:To:From:Date:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=srXp2ZeQ3Jmy2bpwCErKNv0Rk68o1fZG+x04JUpdBnE=; b=QsBv88WsekQlgAebmhRBbGA+/S +0CbQmOielhAhl1yDQuNsIdebOSN4qVdGdBssUJV2+2ETMQGJt8nrHD5IPcbYgWc0bZylePuUXXsP VGZyvaKFrZq/GCrk2vy2p2L65ikHRCzXYIYDKggABFe6c4bC0trgOTq2pe1mwzf3rxI9WkQsDSsoM WM927VgHRx6m52FulSwW7D2jbAjFCteXB6xjIegjciAfbNBDzLS7jdSrgfRcx+uGFPNliQztaSXFI D/Vi/+de+3CqcJmLAAnNTLb5r3Bj389sTwuRJmdgXjVSW1Km9e5wKvG+u6p/NIL5J9kjfqTecqnYa nxnEE8lQ==; Original-Received: from 2603-9001-4203-1ab2-9b5e-6299-1dd8-6818.inf6.spectrum.com ([2603:9001:4203:1ab2:9b5e:6299:1dd8:6818]:35290 helo=[IPv6:::1]) by dancol.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tRBGk-0003Vf-1H; Fri, 27 Dec 2024 09:24:50 -0500 In-Reply-To: <87ttapryxr.fsf@posteo.net> Received-SPF: pass client-ip=2600:3c01:e000:3d8::1; envelope-from=dancol@dancol.org; helo=dancol.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-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.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:327194 Archived-At: On December 27, 2024 9:19:12 AM EST, Philip Kaludercic wrote: >Daniel Colascione writes: > >> On December 27, 2024 7:40:19 AM EST, Eli Zaretskii wro= te: >>>> From: Philip Kaludercic >>>> Cc: Xiyue Deng , emacs-devel@gnu=2Eorg >>>> Date: Fri, 27 Dec 2024 10:54:29 +0000 >>>>=20 >>>> Richard Stallman writes: >>>>=20 >>>> > If we add something like this to Emacs, there is an issue we need t= o >>>> > take care about: to make carefully sure that it does not install >>>> > any nonfree grammars=2E I don't know how those grammars are releas= ed, >>>> > ir by whom, or how much they care about free software=2E We can't >>>> > take for granted that they do=2E >>>> > >>>> > Perhaps we could check automatically that the grammar found is prop= erly >>>> > licenses, and disregard any grammars that are not free=2E >>>> > >>>> > By contrast, if grammars are going to be packaged and released for >>>> > distros, and chosen for installation by users, then it is the user'= s >>>> > responsibility, not Emacs's responsibility, to reject the nonfree o= nes >>>> > (and the GNU/Linux distro might insist on that)=2E >>>>=20 >>>> It might take a while for that to happen, which is why I still believ= e >>>> it would be better if tree-sitter major modes would populate >>>> `treesit-language-source-alist' on their own, and point to the specif= ic >>>> checkouts that the major mode developer tested their implementation >>>> against=2E >>> >>>We could have done that, but there's no way we could keep the value of >>>treesit-language-source-alist up-to-date, because the grammar >>>libraries put out new versions much more frequently than Emacs >>>releases, especially if you consider libraries that have no official >>>versions at all (in which case we can only point to some revision in >>>their repository)=2E >>> >>>The question that bothers me is how useful is it to have >>>treesit-language-source-alist that is outdated? What do we expect the >>>users to do with such an outdated value? >>> >> >> Why not just vendor all the grammars with the Emacs modes that use them= ? > >I am guessing part of the reason is that TS grammars are not fun to >build=2E IIRC they are specified in a Javascript DSL (that used to >require node=2Ejs but AFAIU works with other implementations as well), >that a program written in Rust translates to C code=2E So do we vendor >the DSL and depend on the TreeSitter toolchain or do we vender the >generated code? It's a shame there's no way to write TS grammars in plain elisp=2E I figur= e vendoring both the source and the generated code would be best, as it'd a= llow building Emacs anywhere but still make it convenient on systems with n= eeded tools (JS runtime, Rust, etc=2E) to update and modify the grammar=2E = As with any scheme involving checking in generated outputs, the source and = output can get out of sync, but I think there are build time guardrails we = can build to make sure it doesn't happen=2E