C# bindings to the Tree-sitter parsing library
  • C# 96.2%
  • Makefile 3.8%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Denny Sun 9efad13f04
Merge pull request #4 from pgroene/patch-1
Drop the binaries in the correct output directory
2024-10-25 10:57:10 -07:00
.vscode Minor adjustments to README while trying to build 2023-10-24 11:38:07 -04:00
src c# binding code for tree-sitter and the test code 2023-09-29 04:30:39 -07:00
tests Update test.cs 2023-09-30 15:57:33 -07:00
tree-sitter Merge pull request #4 from pgroene/patch-1 2024-10-25 10:57:10 -07:00
.gitignore c# binding code for tree-sitter and the test code 2023-09-29 04:30:39 -07:00
.gitmodules c# binding code for tree-sitter and the test code 2023-09-29 04:30:39 -07:00
csharp-tree-sitter.csproj c# binding code for tree-sitter and the test code 2023-09-29 04:30:39 -07:00
LICENSE Update LICENSE 2023-09-30 09:25:39 -07:00
README.md Update README.md 2023-10-24 11:40:30 -04:00

csharp-tree-sitter

==================

Introduction

This module provides C# bindings to the 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.

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:

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.