https://github.com/tree-sitter/csharp-tree-sitter
C# bindings to the Tree-sitter parsing library
https://github.com/tree-sitter/csharp-tree-sitter
Last synced: 6 months ago
JSON representation
C# bindings to the Tree-sitter parsing library
- Host: GitHub
- URL: https://github.com/tree-sitter/csharp-tree-sitter
- Owner: tree-sitter
- License: mit
- Created: 2023-09-29T08:28:46.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-25T17:57:10.000Z (about 1 year ago)
- Last Synced: 2025-07-04T14:38:25.575Z (6 months ago)
- Language: C#
- Size: 32.2 KB
- Stars: 96
- Watchers: 5
- Forks: 29
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# csharp-tree-sitter
==================
## Introduction
This module provides C# bindings to the [tree-sitter](https://github.com/tree-sitter/tree-sitter) parsing library, which can enable c# developers be able to invoke the tree-sitter libraries through P/Invoke from their c# code.
## Cloning
This repo includes the needed tree-sitter repos as submodules. Remember to use the `--recursive` option with git clone.
```cmd
git clone https://github.com/tree-sitter/csharp-tree-sitter.git --recursive
```
## Building
Requirements:
- Windows-only (the Makefile in the `tree-sitter` has OS-specific stuff in it so far)
- .NET 7
We'll first need to build the dependencies, and then the C# project.
- get dependencies built
- `cd tree-sitter`
- `nmake`
- `cd ..`
- `dotnet build csharp-tree-sitter.csproj`
## Testing
A good demo is the following, it is a test written in c# which walks the AST tree in post order by calling `tree-sitter-cpp` parser with these bindings.
Assuming you're in VS Code:
- navigate to a C++ file to be parsed
- press `F5` to run with the default 'launch' configuration
Otherwise, you may manually run with:
```cmd
csharp-tree-sitter.exe -files [your test cpp files]
```
TODO: continue here
## Contributing
TODO: Explain how other users and developers can contribute to make your code better.