tree-sitter-c-sharp
C# grammar for tree-sitter
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and fills a specific need for incremental C# parsing in the tree-sitter ecosystem. Install it if you're building tools that parse or analyze C# code and want fast, dependency-light syntax tree generation. The medium install friction is offset by broad platform support and zero runtime dependencies.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; tree-sitter core library must be installed separately.
- Medium install friction due to precompiled wheels across multiple platforms (macOS, Linux, Windows, ARM64), but no runtime dependencies and active maintenance with a recent release.
License · maintenance · safety
MIT (permissive) — MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
last release 2026-04-14 (122 days) · last repo commit 2026-07-20 · 317 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 10,740,479 downloads/mo, #1,439 on PyPI
Alternatives
Verify before relying
pip install tree-sitter-c-sharp
from tree_sitter_c_sharp import language- Whether the parser handles all C# 13.0 features or only those explicitly tested in the grammar
- Performance characteristics for large codebases or real-time parsing scenarios
- Compatibility with specific tree-sitter versions or API stability guarantees
- How to instantiate and use the language binding with tree-sitter's Parser interface
What it is and what it does
tree-sitter-c-sharp is a language grammar binding that plugs C# parsing into the tree-sitter incremental parsing framework. It translates the Roslyn C# grammar into tree-sitter's format, with adaptations to handle preprocessor directives, syntax fragments, and edge cases where the two parsing technologies differ. The result is a fast, incremental parser that builds abstract syntax trees for C# code without external dependencies.
You use it by installing the package and importing the language binding. It's designed for tools that need to analyze, transform, or highlight C# syntax—editors, linters, code generators, or language servers—where incremental re-parsing on edits is valuable. The package supports C# 1 through 13.0, with a documented exception for `async`, `var`, and `await` as identifiers in certain contexts.
Use it for
- Build a C# code linter or style checker that re-parses only changed sections on each edit.
- Implement syntax highlighting or code folding in an editor or IDE plugin using incremental parsing.
- Generate C# AST data for static analysis, refactoring tools, or code generation pipelines.
- Create a language server protocol implementation for C# with incremental parsing support.
- Parse C# code fragments (snippets, REPL input) without requiring a full compilation context.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and fills a specific need for incremental C# parsing in the tree-sitter ecosystem. Install it if you're building tools that parse or analyze C# code and want fast, dependency-light syntax tree generation. The medium install friction is offset by broad platform support and zero runtime dependencies.
Install
tree-sitter-c-sharp on PyPI
Before you install
Medium install friction due to precompiled wheels across multiple platforms (macOS, Linux, Windows, ARM64), but no runtime dependencies and active maintenance with a recent release.
Requires Python 3.9 or later; tree-sitter core library must be installed separately.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install tree-sitter-c-sharp
from tree_sitter_c_sharp import language
Verify before relying
- Whether the parser handles all C# 13.0 features or only those explicitly tested in the grammar
- Performance characteristics for large codebases or real-time parsing scenarios
- Compatibility with specific tree-sitter versions or API stability guarantees
- How to instantiate and use the language binding with tree-sitter's Parser interface
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 122 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 10,740,479 / month, #1,439 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_c_sharp-0.23.5-cp310-abi3-macosx_10_9_x86_64.whl; tree_sitter_c_sharp-0.23.5-cp310-abi3-macosx_11_0_arm64.whl; tree_sitter_c_sharp-0.23.5-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl; tree_sitter_c_sharp-0.23.5-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl; tree_sitter_c_sharp-0.23.5-cp310-abi3-musllinux_1_2_aarch64.whl; tree_sitter_c_sharp-0.23.5-cp310-abi3-musllinux_1_2_x86_64.whl; tree_sitter_c_sharp-0.23.5-cp310-abi3-win_amd64.whl; tree_sitter_c_sharp-0.23.5-cp310-abi3-win_arm64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
An agent finds packages by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language. Give your agent the search over MCP.
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 · tree-sitter-c · tree-sitter-python · tree-sitter-css · tree-sitter-language-pack · tree-sitter-go · tree-sitter-cpp · tree-sitter-php · tree-sitter-kotlin · tree-sitter-json