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: Sun, 29 Dec 2024 19:36:19 -0500 Message-ID: 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> <0883EB00-3BB2-4BC8-95D1-45F4497C0526@dancol.org> <87msge8bv8.fsf@dancol.org> <6771db94.050a0220.386e00.e451SMTPIN_ADDED_BROKEN@mx.google.com> <77FBB3FF-A0F5-416C-AE35-39C0D818FBA9@gmail.com> 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="22344"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: K-9 Mail for Android Cc: Lynn Winebarger , Philip Kaludercic , emacs-devel , Eli Zaretskii , Richard Stallman , manphiz@gmail.com To: Yuan Fu , =?ISO-8859-1?Q?Bj=F6rn_Bidar?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Dec 30 01:36:54 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 1tS3m8-0005hj-Da for ged-emacs-devel@m.gmane-mx.org; Mon, 30 Dec 2024 01:36:52 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tS3ls-0006gv-84; Sun, 29 Dec 2024 19:36:36 -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 1tS3lq-0006eZ-Ir for emacs-devel@gnu.org; Sun, 29 Dec 2024 19:36:34 -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 1tS3lo-0006da-CY; Sun, 29 Dec 2024 19:36:34 -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=t+cZf79hGuA+PrNxP2W0jCAOHoa7ZTyvf2HiMyOOOeY=; b=bxQ0weRTFPVeuZSZvwcrmuyKb/ e41N6waN45Oac5JsLdarEt0x9n+YkZUDy5qF6oT3hV4Xbo9JgeRTRrPe5ATDceqUBQU6HeWysGzjR wirA/Pv2lfQyL2v7fljnmFBFE7MLeZs4Eiex9Ss9mOvxQBhW4C/+TlOtZRkxwF98/A3MmCdHQQRe2 McwsjHnYD9+VJM3doVSoreJCyUSdLLv3qhugHo0iuwWbdUDmGMXaAu0sr9SvMwjE8f37yCL2ZAWa4 dJQ/nY0d3nVRyMo4m9FxzZqn7P2eJQxRbllDyZaYv9zYO1+imgHxiwc4NBLyYYO3UVrnf6yDlgum2 GeFFwCVA==; Original-Received: from 2603-9001-4203-1ab2-761f-9ff1-7620-9ec7.inf6.spectrum.com ([2603:9001:4203:1ab2:761f:9ff1:7620:9ec7]:43860 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 1tS3lg-00025w-2r; Sun, 29 Dec 2024 19:36:25 -0500 In-Reply-To: <77FBB3FF-A0F5-416C-AE35-39C0D818FBA9@gmail.com> 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:327379 Archived-At: On December 29, 2024 7:30:52 PM EST, Yuan Fu wrote: > > >> On Dec 29, 2024, at 3:29=E2=80=AFPM, Bj=C3=B6rn Bidar wrote: >>=20 >> Daniel Colascione writes: >>=20 >>> Lynn Winebarger writes: >>>=20 >>>> On Fri, Dec 27, 2024, 9:25=E2=80=AFAM Daniel Colascione wrote: >>>>=20 >>>>>=20 >>>>>=20 >>>>> It's a shame there's no way to write TS grammars in plain elisp=2E I= figure >>>>> vendoring both the source and the generated code would be best, as i= t'd >>>>> allow building Emacs anywhere but still make it convenient on system= s with >>>>> needed tools (JS runtime, Rust, etc=2E) to update and modify the gra= mmar=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 guardra= ils we >>>>> can build to make sure it doesn't happen=2E >>>>>=20 >>>>=20 >>>> I looked into this last year=2E The tree-sitter library provides a p= arsing >>>> engine that references a fairly standard LR type parsing table in bin= ary >>>> form=2E I got stuck in adding a generic primitive functionality for = reading >>>> and writing arbitrary binary data structures based on a data descript= ion >>>> DSL, since I wouldn't want to tie the interpreter core to the data >>>> structures of an external, dynamically-loadable library=2E But, I wa= sn't >>>> sure such an extension would be accepted into emacs, as I am not an e= xpert >>>> on the possible security implications=2E >>>>=20 >>>> Other than that, emacs already has the code for calculating (LA)LR pa= rsing >>>> tables in the semantic packages=2E The tree-sitter grammar compiler = may have >>>> additional logic for providing multiple starting symbols, but the par= sing >>>> engine should still function with a classic parsing table=2E >>>=20 >>> Thanks=2E Such an approach would let us treat tree-sitter grammars a = lot >>> more like font-lock-keywords, and I think for some modes, that'd be a >>> good option=2E (Of course, SHTDI=2E) >>>=20 >>> Tree sitter, as wonderful as it is, strikes me as a bit of a Rube >>> Goldberg machine architecturally: JS *and* Rust *and* C? Really? :-) > >> I was wondering the same=2E How the hell? There had been some talks to >> support a more lightweight JavaScript interpreter as an alternative but >> it hasn't gone anyway=2E Somehow because compatibility reason=2E I don'= t how >> could node be dependency for these=2E Grammars are mostly without >> dependencies except some have dependencies to other grammars on the >> source level such as the C++ require the C grammar=2E > >I don=E2=80=99t think you need nodejs to build the grammar=2E You might n= eed it to develop the grammar, but compiling grammar=2Ejs to parser=2Ec onl= y requires the tree-sitter CLI which is written in Rust=2E > >Yuan Doesn't the CLI shell out to Node?