
Bindings to 24 Tree-sitter grammars, generated via a custom Gradle plugin, packaging native grammar binaries per target, parser integration and playground with editor, query highlighting, syntax-tree visualization.
Kotlin Multiplatform bindings to 34 Tree-sitter grammars, built on the published
KTreeSitter core (io.github.tree-sitter:ktreesitter). Grammar
bindings are generated by an in-house Gradle plugin ported from the upstream kotlin-tree-sitter plugin.
| Module | Grammar | Published |
|---|---|---|
languages/agda |
tree-sitter-agda v1.3.3 | 1.3.3.2 |
languages/bash |
tree-sitter-bash v0.25.1 | 0.25.1.2 |
languages/c |
tree-sitter-c v0.24.1 | 0.24.1.2 |
languages/c-sharp |
tree-sitter-c-sharp v0.23.1 | 0.23.1.2 |
languages/cpp |
tree-sitter-cpp v0.23.4 | 0.23.4.2 |
languages/css |
tree-sitter-css v0.25.0 | 0.25.0.2 |
languages/embedded-template |
tree-sitter-embedded-template v0.25.0 | 0.25.0.2 |
languages/go |
tree-sitter-go v0.25.0 | 0.25.0.2 |
languages/haskell |
tree-sitter-haskell v0.23.1 | 0.23.1.2 |
languages/html |
tree-sitter-html v0.23.2 | 0.23.2.2 |
languages/java |
tree-sitter-java v0.23.5 | 0.23.5.2 |
languages/javascript |
tree-sitter-javascript v0.25.0 | 0.25.0.2 |
languages/json |
tree-sitter-json v0.24.8 | 0.24.8.2 |
languages/julia |
tree-sitter-julia v0.25.0 | 0.25.0.2 |
languages/ocaml |
tree-sitter-ocaml v0.23.2 (grammars/ocaml) | 0.23.2.2 |
languages/php |
tree-sitter-php v0.24.2 (php/src) | 0.24.2.2 |
languages/python |
tree-sitter-python v0.25.0 | 0.25.0.2 |
languages/regex |
tree-sitter-regex v0.25.0 | 0.25.0.2 |
languages/ruby |
tree-sitter-ruby v0.23.1 | 0.23.1.2 |
languages/rust |
tree-sitter-rust v0.24.0 | 0.24.0.2 |
languages/scala |
tree-sitter-scala v0.24.0 | 0.24.0.2 |
languages/diff |
tree-sitter-diff v0.2.0 | 0.2.0.2 |
languages/glsl |
tree-sitter-glsl v0.2.0 | 0.2.0.2 |
languages/kotlin |
tree-sitter-kotlin 0.3.8 | 0.3.8.2 |
languages/lua |
tree-sitter-lua v0.5.0 | 0.5.0.2 |
languages/markdown |
tree-sitter-markdown v0.5.3 | 0.5.3.2 |
languages/properties |
tree-sitter-properties v0.3.0 | 0.3.0.2 |
languages/smali |
tree-sitter-smali 1.0.0 (tag stable) |
1.0.0.2 |
languages/toml |
tree-sitter-toml v0.7.0 | 0.7.0.2 |
languages/xml |
tree-sitter-xml v0.7.0 (xml/src) | 0.7.0.2 |
languages/yaml |
tree-sitter-yaml v0.7.2 | 0.7.2.2 |
languages/tsx |
tree-sitter-typescript v0.23.2 (tsx/src) | 0.23.2.2 |
languages/typescript |
tree-sitter-typescript v0.23.2 (typescript/src) | 0.23.2.2 |
languages/verilog |
tree-sitter-verilog v1.0.3 | 1.0.3.2 |
Each grammar repository is pinned as a git submodule (SSH URL) under languages/<name>/tree-sitter-<name>
by its release tag. tsx and typescript share the tree-sitter-typescript repository; ocaml builds the
grammars/ocaml grammar.
Every language module targets:
linuxX64, linuxArm64, mingwX64, macosX64, macosArm64, iosArm64, iosSimulatorArm64
gradle/libs.versions.toml — version catalog (Kotlin 2.3.20, AGP 9.3.1, KTreeSitter; build-logic dependencies are declared here too)build-logic/ — in-house tree-sitter-grammar plugin (grammar file generation, JNI/CMake scaffolding, cinterop
wiring) plus the tree-sitter-language convention plugin driving every languages/* moduleLanguages are published to Maven Central with com.vanniktech.maven.publish 0.37.0. Each language publishes a JVM jar plus one JNI artifact per platform (sdl-kmp layout):
./gradlew :languages:java:publishToMavenLocal # java jvm jar + jni artifacts to Maven Local
./gradlew :jni:java-darwin-aarch64:publishToMavenLocal # single platform jni artifactCoordinates: cn.enaium.treesitter:treesitter-languages-<lang>-kmp-jvm:<version> for the pure-Java JVM jar and
cn.enaium.treesitter:treesitter-languages-<lang>-kmp-jni-<platform>:<version> for the per-platform JNI jars
(darwin-aarch64, darwin-x86_64, linux-x86_64, linux-aarch64, windows-x86_64), each embedding the native
grammar library at lib/<os>/<arch>/libktreesitter-<lang>.<ext>.
Each language module is versioned by its grammar repository tag plus a .1 release suffix (e.g.
tree-sitter-java v0.23.5 -> treesitter-languages-java-kmp-jvm:0.23.5.2, tree-sitter-xml v0.7.0 ->
treesitter-languages-xml-kmp-jvm:0.7.0.2), read from the pinned submodule tag at build time (smali is pinned to
1.0.0.2 because its repo tags releases as stable).
The jvm POM lists all five JNI artifacts as runtime dependencies; the generated binding's libPath() picks the
native library matching the consumer's OS/arch from whichever JNI jar the dependency resolution selected.
CI (.github/workflows/test.yml) builds each platform's JNI libraries, publishes the java/xml jvm jars and the
platform's JNI jars to Maven Local, and verifies the native library is embedded. .github/workflows/publish.yml
publishes java/xml to Maven Central (manual trigger).
// build.gradle.kts
repositories { mavenLocal(); mavenCentral() }
dependencies {
implementation("io.github.tree-sitter:ktreesitter:0.25.1")
implementation("cn.enaium.treesitter:treesitter-languages-java-kmp-jvm:0.25.1")
}import io.github.treesitter.ktreesitter.Language
import io.github.treesitter.ktreesitter.Parser
import cn.enaium.treesitter.languages.java.TreeSitterJava
val language = Language(TreeSitterJava.language())
val parser = Parser(language)
val tree = parser.parse("class A { int x; }")
println(tree.rootNode.type) // program./gradlew :languages:java:jvmTest # JVM (builds JNI lib via CMake)
./gradlew :languages:java:macosArm64Test # Kotlin/Native (cinterop)
./gradlew :languages:java:compileAndroidMain # Android
./gradlew :example:run # Compose desktop playgroundRequires JDK 17+ (JDK 21 recommended), the Android SDK with NDK (see gradle.properties), and CMake for JNI builds.
Gradle 9.7 / AGP 9.3.1 / Kotlin 2.3.20.
tree-sitter-grammar plugin in build-logic/ is a port of the upstream io.github.tree-sitter.ktreesitter-plugin; the published Gradle plugin is not used.com.android.kotlin.multiplatform.library plugin has no externalNativeBuild DSL, so the Android JNI
library is compiled directly with the NDK toolchain into src/androidMain/jniLibs (arm64-v8a, armeabi-v7a, x86_64).ts_parser_parse_string_encoding; non-ASCII sources can be truncated on Kotlin/Native targets. Samples are ASCII
to avoid tripping this upstream issue (the JVM binding uses the correct UTF length).example/ is a Compose Multiplatform port of the
tree-sitter playground:
Targets: desktop (JVM), Android, iOS, macOS. Run with ./gradlew :example:run (desktop).
Note: Compose Multiplatform 1.12 publishes artifacts only for macosArm64 (native desktop), not linuxX64/mingwX64, so the example targets macosArm64/iOS plus Android/JVM.
Kotlin Multiplatform bindings to 34 Tree-sitter grammars, built on the published
KTreeSitter core (io.github.tree-sitter:ktreesitter). Grammar
bindings are generated by an in-house Gradle plugin ported from the upstream kotlin-tree-sitter plugin.
| Module | Grammar | Published |
|---|---|---|
languages/agda |
tree-sitter-agda v1.3.3 | 1.3.3.2 |
languages/bash |
tree-sitter-bash v0.25.1 | 0.25.1.2 |
languages/c |
tree-sitter-c v0.24.1 | 0.24.1.2 |
languages/c-sharp |
tree-sitter-c-sharp v0.23.1 | 0.23.1.2 |
languages/cpp |
tree-sitter-cpp v0.23.4 | 0.23.4.2 |
languages/css |
tree-sitter-css v0.25.0 | 0.25.0.2 |
languages/embedded-template |
tree-sitter-embedded-template v0.25.0 | 0.25.0.2 |
languages/go |
tree-sitter-go v0.25.0 | 0.25.0.2 |
languages/haskell |
tree-sitter-haskell v0.23.1 | 0.23.1.2 |
languages/html |
tree-sitter-html v0.23.2 | 0.23.2.2 |
languages/java |
tree-sitter-java v0.23.5 | 0.23.5.2 |
languages/javascript |
tree-sitter-javascript v0.25.0 | 0.25.0.2 |
languages/json |
tree-sitter-json v0.24.8 | 0.24.8.2 |
languages/julia |
tree-sitter-julia v0.25.0 | 0.25.0.2 |
languages/ocaml |
tree-sitter-ocaml v0.23.2 (grammars/ocaml) | 0.23.2.2 |
languages/php |
tree-sitter-php v0.24.2 (php/src) | 0.24.2.2 |
languages/python |
tree-sitter-python v0.25.0 | 0.25.0.2 |
languages/regex |
tree-sitter-regex v0.25.0 | 0.25.0.2 |
languages/ruby |
tree-sitter-ruby v0.23.1 | 0.23.1.2 |
languages/rust |
tree-sitter-rust v0.24.0 | 0.24.0.2 |
languages/scala |
tree-sitter-scala v0.24.0 | 0.24.0.2 |
languages/diff |
tree-sitter-diff v0.2.0 | 0.2.0.2 |
languages/glsl |
tree-sitter-glsl v0.2.0 | 0.2.0.2 |
languages/kotlin |
tree-sitter-kotlin 0.3.8 | 0.3.8.2 |
languages/lua |
tree-sitter-lua v0.5.0 | 0.5.0.2 |
languages/markdown |
tree-sitter-markdown v0.5.3 | 0.5.3.2 |
languages/properties |
tree-sitter-properties v0.3.0 | 0.3.0.2 |
languages/smali |
tree-sitter-smali 1.0.0 (tag stable) |
1.0.0.2 |
languages/toml |
tree-sitter-toml v0.7.0 | 0.7.0.2 |
languages/xml |
tree-sitter-xml v0.7.0 (xml/src) | 0.7.0.2 |
languages/yaml |
tree-sitter-yaml v0.7.2 | 0.7.2.2 |
languages/tsx |
tree-sitter-typescript v0.23.2 (tsx/src) | 0.23.2.2 |
languages/typescript |
tree-sitter-typescript v0.23.2 (typescript/src) | 0.23.2.2 |
languages/verilog |
tree-sitter-verilog v1.0.3 | 1.0.3.2 |
Each grammar repository is pinned as a git submodule (SSH URL) under languages/<name>/tree-sitter-<name>
by its release tag. tsx and typescript share the tree-sitter-typescript repository; ocaml builds the
grammars/ocaml grammar.
Every language module targets:
linuxX64, linuxArm64, mingwX64, macosX64, macosArm64, iosArm64, iosSimulatorArm64
gradle/libs.versions.toml — version catalog (Kotlin 2.3.20, AGP 9.3.1, KTreeSitter; build-logic dependencies are declared here too)build-logic/ — in-house tree-sitter-grammar plugin (grammar file generation, JNI/CMake scaffolding, cinterop
wiring) plus the tree-sitter-language convention plugin driving every languages/* moduleLanguages are published to Maven Central with com.vanniktech.maven.publish 0.37.0. Each language publishes a JVM jar plus one JNI artifact per platform (sdl-kmp layout):
./gradlew :languages:java:publishToMavenLocal # java jvm jar + jni artifacts to Maven Local
./gradlew :jni:java-darwin-aarch64:publishToMavenLocal # single platform jni artifactCoordinates: cn.enaium.treesitter:treesitter-languages-<lang>-kmp-jvm:<version> for the pure-Java JVM jar and
cn.enaium.treesitter:treesitter-languages-<lang>-kmp-jni-<platform>:<version> for the per-platform JNI jars
(darwin-aarch64, darwin-x86_64, linux-x86_64, linux-aarch64, windows-x86_64), each embedding the native
grammar library at lib/<os>/<arch>/libktreesitter-<lang>.<ext>.
Each language module is versioned by its grammar repository tag plus a .1 release suffix (e.g.
tree-sitter-java v0.23.5 -> treesitter-languages-java-kmp-jvm:0.23.5.2, tree-sitter-xml v0.7.0 ->
treesitter-languages-xml-kmp-jvm:0.7.0.2), read from the pinned submodule tag at build time (smali is pinned to
1.0.0.2 because its repo tags releases as stable).
The jvm POM lists all five JNI artifacts as runtime dependencies; the generated binding's libPath() picks the
native library matching the consumer's OS/arch from whichever JNI jar the dependency resolution selected.
CI (.github/workflows/test.yml) builds each platform's JNI libraries, publishes the java/xml jvm jars and the
platform's JNI jars to Maven Local, and verifies the native library is embedded. .github/workflows/publish.yml
publishes java/xml to Maven Central (manual trigger).
// build.gradle.kts
repositories { mavenLocal(); mavenCentral() }
dependencies {
implementation("io.github.tree-sitter:ktreesitter:0.25.1")
implementation("cn.enaium.treesitter:treesitter-languages-java-kmp-jvm:0.25.1")
}import io.github.treesitter.ktreesitter.Language
import io.github.treesitter.ktreesitter.Parser
import cn.enaium.treesitter.languages.java.TreeSitterJava
val language = Language(TreeSitterJava.language())
val parser = Parser(language)
val tree = parser.parse("class A { int x; }")
println(tree.rootNode.type) // program./gradlew :languages:java:jvmTest # JVM (builds JNI lib via CMake)
./gradlew :languages:java:macosArm64Test # Kotlin/Native (cinterop)
./gradlew :languages:java:compileAndroidMain # Android
./gradlew :example:run # Compose desktop playgroundRequires JDK 17+ (JDK 21 recommended), the Android SDK with NDK (see gradle.properties), and CMake for JNI builds.
Gradle 9.7 / AGP 9.3.1 / Kotlin 2.3.20.
tree-sitter-grammar plugin in build-logic/ is a port of the upstream io.github.tree-sitter.ktreesitter-plugin; the published Gradle plugin is not used.com.android.kotlin.multiplatform.library plugin has no externalNativeBuild DSL, so the Android JNI
library is compiled directly with the NDK toolchain into src/androidMain/jniLibs (arm64-v8a, armeabi-v7a, x86_64).ts_parser_parse_string_encoding; non-ASCII sources can be truncated on Kotlin/Native targets. Samples are ASCII
to avoid tripping this upstream issue (the JVM binding uses the correct UTF length).example/ is a Compose Multiplatform port of the
tree-sitter playground:
Targets: desktop (JVM), Android, iOS, macOS. Run with ./gradlew :example:run (desktop).
Note: Compose Multiplatform 1.12 publishes artifacts only for macosArm64 (native desktop), not linuxX64/mingwX64, so the example targets macosArm64/iOS plus Android/JVM.