A vcpkg registry for building and installing tree-sitter parsers.
The plan is to eventually upstream all of this, see microsoft/vcpkg#26272
- cross-platform support powered by cmake and vcpkg
- allows both dynamic and static builds
- strict ABI versioning, but can still be overridden with
--overlay-ports=<path>
- helper function for integrating additional parsers, see ports/tree-sitter-common
- install
vcpkg
- copy both config files from
example
into the desired folder - run
vcpkg install
(a.k.a. manifest mode) in that folder
Check .github/workflows/vcpkg.yml for a full example.
use a common CMakeLists.txt
that knows how to build all these parsers.
- each parser requires building one or two C/C++ generated files (
parser.c
,scanner.[c|cc]
) - the generated files do not include any external C/C++ dependencies
- currently, these generated files are checked in into the repo, but the might change
tree-sitter-cli
is used to generate these files in case of an ABI version mismatchTree-sitter grammars are written in JavaScript, and Tree-sitter uses Node.js to interpret JavaScript files. It requires the node command to be in one of the directories in your PATH. You’ll need Node.js version 6.0 or greater.
The Tree-sitter library can be used with language parsers that were built with an older version of Tree-sitter, but the reverse does not work. The exact language versions that work with the current library version are defined by these two constants in
api.h
.
I'm currently imposing a specific ABI version, but still trying to make it clear how to override
it,
which requires tree-sitter-cli