emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tree-sitter introduction documentation


From: Tim Cross
Subject: Re: Tree-sitter introduction documentation
Date: Sat, 17 Dec 2022 11:03:50 +1100
User-agent: mu4e 1.9.7; emacs 29.0.60

Eli Zaretskii <eliz@gnu.org> writes:

>> From: João Távora <joaotavora@gmail.com>
>> Date: Fri, 16 Dec 2022 15:48:03 +0000
>> Cc: pedz@easesoftware.com, emacs-devel@gnu.org
>> 
>>  No, you don't need a NodeJS toolchain to compile a grammar.  You only
>>  need to compile the C/C++ source files that are part of the grammar,
>>  and then link them into a shared library.  I use a simple Makefile to
>>  build all of them, as the structure of the files and the way to
>>  compile and link them are identical and boilerplate.  And I definitely
>>  don't have NodeJS installed here.
>> 
>> I used:
>> 
>>    https://aur.archlinux.org/packages/tree-sitter-cpp-git
>> 
>> which builds with the makepkg tool, and am pretty sure
>> it used NodeJS somewhere down the line.  The language
>> definition it seems to use is https://github.com/tree-sitter/tree-sitter-cpp
>> which also contains a log of JS stuff.
>
> It might contain JS stuff, but you only need to compile and link the
> C/C++ files in the src subdirectory.  You don't need to even look at
> the rest.
>
>> Is that where you get your C++ grammar from?
>
> Yes.
>
>> If so where do you get your grammars from and can we 
>> bundle some version of them with Emacs?
>
> No, we won't bundle grammar libraries with Emacs.  It is not in the
> scope of the Emacs project to provide external libraries; that's for
> distros to arrange and for the individual users to install by
> themselves.
>
> There are limits to what Emacs as a project can do about using
> external libraries and tools.

Given the installation of language grammars is reasonably straight
forward (from what you posted earlier), what about adding a package to
GNU ELPA which could facilitate/do the installation of a set of
language grammars (similar to what the
admin/notes/tree-sitter/build-modules/batch.sh script does.

In addition to making it easier to install required dependencies and
avoid the long tail that will likely exist for many distributions in
implementing packages to install these grammars, it would also help
ensure people install grammars with an acceptable license and
avoid/reduce unwittingly installing non-free licensed code.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]