tree-sitter-cpp
C++ grammar for tree-sitter
Decision gist · record as of 2026-08-14
Yes, if you need C++ parsing within a Python application and are already using or planning to use tree-sitter. The permissive MIT license, active maintenance, and prebuilt wheels for common platforms make it a low-friction choice. No known security vulnerabilities. Verify that your use case aligns with tree-sitter's incremental parsing model and that you have or will install the core tree-sitter Python bindings separately.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; prebuilt wheels available for common platforms but may require compilation on unsupported architectures.
- Medium install friction due to binary wheels for multiple platforms (macOS, Linux, Windows, ARM); prebuilt binaries available for Python 3.9+ reduce compilation overhead.
- Repository is actively maintained with recent commits.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions.
last release 2024-11-11 (641 days) · last repo commit 2026-02-25 · 445 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 4,786,023 downloads/mo, #2,231 on PyPI
Alternatives
Verify before relying
pip install tree-sitter-cpp
from tree_sitter_cpp import language
parser = language.parser()
tree = parser.parse(b'int main() { return 0; }')- Whether the package provides direct parsing APIs or requires a separate tree-sitter Python binding to be installed alongside it.
- Performance characteristics and memory overhead for parsing large C++ files or codebases.
- Completeness of C++ standard coverage (C++11, C++17, C++20, etc.) in the grammar.
What it is and what it does
tree-sitter-cpp is a C++ language grammar for the tree-sitter incremental parsing framework. It translates C++ source code into syntax trees that can be traversed and analyzed programmatically. The package ships as prebuilt binary wheels for major platforms, avoiding compilation on installation.
The grammar enables use cases like code analysis, refactoring tools, linters, and IDE features that need to understand C++ structure. It integrates with tree-sitter's ecosystem and follows the C++ BNF specification, supporting incremental updates when code changes rather than reparsing from scratch.
Use it for
- Build code analysis and linting tools that need to parse and inspect C++ syntax trees.
- Implement IDE features like syntax highlighting, code navigation, and refactoring for C++ editors.
- Analyze C++ codebases to extract metrics, dependencies, or patterns without invoking a full compiler.
- Create documentation generators or code transformation tools that operate on C++ ASTs.
- Develop static analysis or security scanning tools that examine C++ code structure.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need C++ parsing within a Python application and are already using or planning to use tree-sitter.
The permissive MIT license, active maintenance, and prebuilt wheels for common platforms make it a low-friction choice. No known security vulnerabilities. Verify that your use case aligns with tree-sitter's incremental parsing model and that you have or will install the core tree-sitter Python bindings separately.
Install
tree-sitter-cpp on PyPI
Before you install
Medium install friction due to binary wheels for multiple platforms (macOS, Linux, Windows, ARM); prebuilt binaries available for Python 3.9+ reduce compilation overhead. Repository is actively maintained with recent commits.
Requires Python 3.9 or later; prebuilt wheels available for common platforms but may require compilation on unsupported architectures.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal restrictions.
Quickstart
pip install tree-sitter-cpp
from tree_sitter_cpp import language
parser = language.parser()
tree = parser.parse(b'int main() { return 0; }')
Verify before relying
- Whether the package provides direct parsing APIs or requires a separate tree-sitter Python binding to be installed alongside it.
- Performance characteristics and memory overhead for parsing large C++ files or codebases.
- Completeness of C++ standard coverage (C++11, C++17, C++20, etc.) in the grammar.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 641 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 4,786,023 / month, #2,231 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseTopic :: Software Development :: CompilersTopic :: Text Processing :: LinguisticTyping :: Typed |
Evidence: tree_sitter_cpp-0.23.4-cp39-abi3-macosx_10_9_x86_64.whl; tree_sitter_cpp-0.23.4-cp39-abi3-macosx_11_0_arm64.whl; tree_sitter_cpp-0.23.4-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; tree_sitter_cpp-0.23.4-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; tree_sitter_cpp-0.23.4-cp39-abi3-musllinux_1_2_x86_64.whl; tree_sitter_cpp-0.23.4-cp39-abi3-win_amd64.whl; tree_sitter_cpp-0.23.4-cp39-abi3-win_arm64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “tree-sitter c++ language”
- tree-sitter-cppProvides a C++ language grammar for tree-sitter, enabling incremental…
- tree-sitter-goProvides a Go language grammar for tree-sitter, enabling incremental…
- tree-sitter-c-sharpProvides a C# language parser for tree-sitter, enabling incremental…
Give your agent the search over MCP, or paste the wish link into any chat.
More Linguistic packages
Detects and normalizes text encoding from unknown or ambiguous sources, supporting all IANA character sets that Python's core library provides codecs for, with the ability to register custom codecs.
tiktoken is a fast BPE tokenizer that converts text into token sequences compatible with OpenAI models, supporting multiple encoding schemes including o200k_base and model-specific encodings.
Install it if you work with OpenAI APIs or need to understand token boundaries in GPT-family models.
Detects character encoding and language in byte sequences with high accuracy, supporting 99 encodings and returning confidence scores, language tags, and MIME types.
Install it if you need to detect character encoding or language in byte data; the rewrite makes it substantially faster and more accurate than its predecessors.
Converts Unicode text to ASCII by transliterating non-ASCII characters into their closest ASCII equivalents, with no runtime dependencies.
However, if transliteration quality or ongoing maintenance matters, consider unidecode instead despite its GPL-only license.
Lark is a parsing library that builds abstract syntax trees from context-free grammars, supporting multiple parsing algorithms (Earley, LALR(1), CYK) with automatic line and column tracking.
Python bindings to the tree-sitter parsing library, enabling incremental parsing and syntax tree analysis for source code.
See also tree-sitter-java · cxxheaderparser · tree-sitter-python · tree-sitter-c · tree-sitter-php · tree-sitter-go · tree-sitter-kotlin · tree-sitter-c-sharp · tree-sitter-css · tree-sitter-json