tech-pkg archive

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

tree-sitter grammars



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


Home | Main Index | Thread Index | Old Index