Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

COBOL is for morons. -- E. W. Dijkstra


devel / comp.lang.ada / Emacs mode: using tree-sitter

SubjectAuthor
* Emacs mode: using tree-sitterEmmanuel Briot
`- Re: Emacs mode: using tree-sitterStephen Leake

1
Emacs mode: using tree-sitter

<fcbb1f91-fdc1-465d-9836-58ab94084e8cn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5762&group=comp.lang.ada#5762

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:135c:: with SMTP id c28mr21092866qkl.18.1630315308380; Mon, 30 Aug 2021 02:21:48 -0700 (PDT)
X-Received: by 2002:a25:b18e:: with SMTP id h14mr23157679ybj.165.1630315308021; Mon, 30 Aug 2021 02:21:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Mon, 30 Aug 2021 02:21:47 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=87.88.29.208; posting-account=6yLzewoAAABoisbSsCJH1SPMc9UrfXBH
NNTP-Posting-Host: 87.88.29.208
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <fcbb1f91-fdc1-465d-9836-58ab94084e8cn@googlegroups.com>
Subject: Emacs mode: using tree-sitter
From: briot.em...@gmail.com (Emmanuel Briot)
Injection-Date: Mon, 30 Aug 2021 09:21:48 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 25
 by: Emmanuel Briot - Mon, 30 Aug 2021 09:21 UTC

I was looking recently at both Emacs and vim recent updates, and noted that both those tools now provide interfaces to tree-sitter (https://tree-sitter.github.io/tree-sitter/) which is a parser generator and incremental parsing library. It doesn't have an Ada parser yet, though :-(

It might be nice, as a community, to work on such a parser though. I did not look into what that implies yet, maybe someone else has already started work on that.

The advantage might be that the Emacs ada-mode can use that instead of its home-brewed parser (which although I am sure it was fun to develop still likely requires some maintenance by Stephen, and definitely requires manually compiling some Ada code before we can use the ada-mode).

We could also use it to improve the current vim ada-mode, which hasn't been updated in years and could do with various improvements.

Finally, maybe we could talk with the GNAT Studio team. I don't think they have looked into tree-sitter yet, but it might be useful.

I do not know whether tools like Visual Studio Code also interface with tree-sitter, but maybe that library will become the equivalent of the Language Server Protocol, and companies provide one tree-sitter parser + one language server and the IDE automatically gains support for Ada

Emmanuel

Re: Emacs mode: using tree-sitter

<868s0i30ux.fsf@stephe-leake.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=5768&group=comp.lang.ada#5768

  copy link   Newsgroups: comp.lang.ada
Path: i2pn2.org!i2pn.org!aioe.org!9CzwYWWlKVx8RMZd/VcwFg.user.46.165.242.75.POSTED!not-for-mail
From: stephen_...@stephe-leake.org (Stephen Leake)
Newsgroups: comp.lang.ada
Subject: Re: Emacs mode: using tree-sitter
Date: Mon, 30 Aug 2021 17:37:58 -0700
Organization: Aioe.org NNTP Server
Message-ID: <868s0i30ux.fsf@stephe-leake.org>
References: <fcbb1f91-fdc1-465d-9836-58ab94084e8cn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: gioia.aioe.org; logging-data="65113"; posting-host="9CzwYWWlKVx8RMZd/VcwFg.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt)
X-Notice: Filtered by postfilter v. 0.9.2
Cancel-Lock: sha1:zSb3UCx7nsOfWJa7/3+beK2K0WA=
 by: Stephen Leake - Tue, 31 Aug 2021 00:37 UTC

Emmanuel Briot <briot.emmanuel@gmail.com> writes:

> I was looking recently at both Emacs and vim recent updates, and noted
> that both those tools now provide interfaces to tree-sitter
> (https://tree-sitter.github.io/tree-sitter/) which is a parser
> generator and incremental parsing library. It doesn't have an Ada
> parser yet, though :-(

And it won't until the parser generator gets a serious overhaul:

https://github.com/tree-sitter/tree-sitter/issues/693

> It might be nice, as a community, to work on such a parser though. I
> did not look into what that implies yet, maybe someone else has
> already started work on that.

Yes, me. There is code in wisitoken devel that converts any wisitoken
grammar to tree-sitter syntax. I find EBNF much more readable than the
javascript DSL tree-sitter uses.

> The advantage might be that the Emacs ada-mode can use that instead of
> its home-brewed parser (which although I am sure it was fun to develop
> still likely requires some maintenance by Stephen, and definitely
> requires manually compiling some Ada code before we can use the
> ada-mode).

Someone would have to maintain the tree-sitter parser; it's not magic.

And you'd have to compile the tree-sitter parser as well. Again, not magic.

> We could also use it to improve the current vim ada-mode, which hasn't
> been updated in years and could do with various improvements.

It might be easier to adapt the Emacs ada-mode code to meet the vim
plugin interface.

Or adapt Emacs ada-mode code to LSP, that would benefit many editors.

> Finally, maybe we could talk with the GNAT Studio team. I don't think
> they have looked into tree-sitter yet, but it might be useful.

They provide an LSP ada-language-server:
https://github.com/AdaCore/ada_language_server

It is not as feature rich as the ada-mode parser.

I doubt they have the resources for anything more (unless the request
comes with money, of course).

--
-- Stephe

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor