Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tree-sitter/tree-sitter/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
Parsers generated with Tree-sitter have an associated ABI (Application Binary Interface) version, which establishes hard compatibility boundaries between the generated parser and the Tree-sitter library. A given version of the Tree-sitter library is only able to load parsers generated with supported ABI versions.Current ABI Version
The latest ABI version is defined in the Tree-sitter API:Latest ABI
Version 15 - The latest ABI version supported by the current library
Minimum ABI
Version 13 - The earliest ABI version that can still be loaded
Compatibility Matrix
The following table shows which ABI versions are supported by which Tree-sitter library versions:| Tree-sitter Version | Min Parser ABI | Max Parser ABI |
|---|---|---|
| 0.14 | 9 | 9 |
| ≥ 0.15.0, ≤ 0.15.7 | 9 | 10 |
| ≥ 0.15.8, ≤ 0.16 | 9 | 11 |
| 0.17, 0.18 | 9 | 12 |
| ≥ 0.19, ≤ 0.20.2 | 13 | 13 |
| ≥ 0.20.3, ≤ 0.24 | 13 | 14 |
| ≥ 0.25 | 13 | 15 |
The Tree-sitter library is generally backwards-compatible with languages generated using older CLI versions, but is not forwards-compatible. You cannot use a parser with a newer ABI version than the library supports.
Checking Compatibility
When setting a language on a parser, Tree-sitter automatically checks ABI compatibility:Generating Parsers with Specific ABI Versions
By default, the Tree-sitter CLI will generate parsers using the latest available ABI for that version. However, you can select an older ABI using the--abi option:
When to Regenerate Parsers
You should regenerate your parser when:Upgrading Tree-sitter
When you upgrade to a major or minor version of Tree-sitter that introduces a new ABI version, regenerate your parsers to take advantage of new features and optimizations.
Supporting older libraries
If you need your parser to work with older versions of the Tree-sitter library, generate it with an older ABI version using
--abi.ABI Version Changes
ABI versions may change when Tree-sitter introduces:- New language features in the grammar DSL
- Changes to the generated parser structure
- New runtime capabilities
- Performance improvements requiring structural changes
Major ABI changes
Major ABI changes
Some notable ABI version changes:
- ABI 13 (Tree-sitter 0.19): Major rewrite of the runtime for improved performance
- ABI 14 (Tree-sitter 0.20.3): Added support for language metadata
- ABI 15 (Tree-sitter 0.25): Enhanced query capabilities and optimizations
Best Practices
Keep Libraries Updated
Regularly update your Tree-sitter library to get the latest features and bug fixes.
Document Requirements
Clearly document which Tree-sitter version your parser requires.
Test Compatibility
Test your parser with the minimum supported Tree-sitter version.
Automate Regeneration
Use CI/CD to automatically regenerate parsers when Tree-sitter is updated.
Package.json Example
If you’re publishing a parser as an npm package, specify the Tree-sitter version requirement:package.json
Cargo.toml Example
For Rust projects, specify the version inCargo.toml:
Cargo.toml
Troubleshooting
Error: Language version X is too old
Error: Language version X is too old
This means your parser was generated with an ABI version older than the minimum supported by the current Tree-sitter library.Solution: Regenerate your parser with the Tree-sitter CLI:
Error: Language version X is too new
Error: Language version X is too new
This means your parser was generated with an ABI version newer than what the current Tree-sitter library supports.Solution: Either:
- Update your Tree-sitter library to a newer version
- Regenerate the parser with an older ABI version:
My parser works locally but not for users
My parser works locally but not for users
Users may have an older version of Tree-sitter installed.Solution:
- Check what Tree-sitter version your users have
- Either ask users to upgrade, or regenerate with a compatible ABI:
- Document the minimum required Tree-sitter version
How do I check my parser's ABI version?
How do I check my parser's ABI version?
You can check the ABI version programmatically or by looking at the generated
parser.c file:Version Detection Script
Here’s a script to check ABI compatibility:check_abi.py
Further Reading
Creating Parsers
Learn how to create your own Tree-sitter parser
CLI Documentation
Read about the tree-sitter generate command
Contributing
Contribute to Tree-sitter development
For the most up-to-date information about ABI versions, always check the official Tree-sitter repository and release notes.