tech-pkg archive

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

tree-sitter grammars


There are already some packages (like editors/helix) that are
including grammars for tree-sitter (a fast language grammar parsing

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
    g++ -I. -c -fPIC

    g++ --shared -o $ scanner.o parser.o

    install $ ${PREFIX}/libexec/tree-sitter

Is someone already using a tree-sitter enabled editor and can give
this a try?

Home | Main Index | Thread Index | Old Index