comp.lang.ada
 help / color / mirror / Atom feed
* Emacs mode: using tree-sitter
@ 2021-08-30  9:21 Emmanuel Briot
  2021-08-31  0:37 ` Stephen Leake
  0 siblings, 1 reply; 2+ messages in thread
From: Emmanuel Briot @ 2021-08-30  9:21 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Emacs mode: using tree-sitter
  2021-08-30  9:21 Emacs mode: using tree-sitter Emmanuel Briot
@ 2021-08-31  0:37 ` Stephen Leake
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Leake @ 2021-08-31  0:37 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-31  0:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30  9:21 Emacs mode: using tree-sitter Emmanuel Briot
2021-08-31  0:37 ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox