tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: tree-sitter grammars
------- Original Message -------
On Tuesday, January 17th, 2023 at 10:50 PM, Thomas Klausner <wiz%NetBSD.org@localhost> wrote:
> Hi!
>
> There are already some packages (like editors/helix) that are
> including grammars for tree-sitter (a fast language grammar parsing
> tool).
>
> I think it doesn't scale to include them all in each editor that needs
> them. If I understand correctly, they can be installed as shared
> objects and loaded by the users.
>
> I found no documentation for that but I think the following should
> create the appropriate objects:
>
> cd src
>
> NAME=$(jq .name grammar.json| tr -d \")
>
> gcc -std=c99 -I. -c -fPIC parser.c
>
> gcc -std=c99 -I. -c -fPIC scanner.c
> OR
> g++ -I. -c -fPIC scanner.cc
>
> g++ --shared -o $NAME.so scanner.o parser.o
>
> install $NAME.so ${PREFIX}/libexec/tree-sitter
>
> Is someone already using a tree-sitter enabled editor and can give
> this a try?
> Thomas
This would be awesome, devel/diffsitter would benefit from it as it's currently built expecting internal tree-sitter grammars.
/pin
Home |
Main Index |
Thread Index |
Old Index