Kevin Schoon 8 months ago
10 commits
main
63ec8ac1
split up build steps
README.md

tree-sitter-amalgamation

All of the tree-sitter parsers imported as submodules and compiled for easy use by downstream projects. Each parser is exposed as a shared module that can be dynamically loaded in another application. Generated source code is also shipped for use in build scripts.

Installation

The best way to install this is via your package manager.

Known Distribution Packages

aur

Manual Installation

sudo ./install.sh
# uninstall
sudo ./uninstall.sh

Compiling

You need to install ninja to build the project as well as an ANSI C compiler.

git submodule update --init --recursive
# generate tree-sitter parsers
./generate.py
# package all of the parsers into the target directory
./package.py
# compile shared parser objects
./compile.py

Adding New Languages

# add a new submodule to the repository
cd grammars && git submodule add $your-tree-sitter-project
# edit the build.py package adding your source module and adjust as needed
vim build.py
# regenerate the build.ninja script
python build.py
# rebuild the project
ninja

Packagers

Suggested filesystem layout for package maintainers.

/usr/lib/tree-sitter-amalgamation/$language.so
/usr/include/tree-sitter-amalgamation/$language/queries/highlights.scm
/usr/include/tree-sitter-amalgamation/$language/parser.c
/usr/include/tree-sitter-amalgamation/$language/scanner.c
/usr/include/tree-sitter-amalgamation/$language/common/scanner.h