tree-sitter-sdif
Tree-sitter grammar for SDIF syntax highlighting,
editor integrations and incremental parse tooling.
What this is · Quick start · File types · Conformance · Related
This package provides a Tree-sitter grammar for SDIF editor tooling and incremental parsing.
It is intentionally tooling-only. The normative parser and canonical AST live in the core sdif-py repository, under src/sdif/. The specification itself is defined in sdif-spec. This grammar is for editors and tooling consumers, not for implementing the SDIF specification.
It does not validate schemas, canonical ordering, semantic relations, hashes or .sdif.ai reversibility. Those checks belong to the core SDIF implementation.
The package registers both sdif and sdif.ai file types so editor integrations can attach the same grammar to canonical source files and compact AI projection surfaces.
Install a Tree-sitter CLI compatible with this package and run:
npm install
npm run generate
npm testThe corpus starts at test/corpus/core.txt and covers representative SDIF documents, .sdif.ai compact table syntax and the common patterns defined in the conformance suite.
| Extension | Format | Purpose |
|---|---|---|
.sdif |
Canonical SDIF | Source files, canonical form, hashing and signing surface |
.sdif.ai |
AI projection | Token-dense agent exchange; reversible to canonical SDIF |
SDIF and .sdif.ai are the agent-facing interchange surfaces. JSON fixtures may exist for equivalence checks, but agents do not need JSON to work with SDIF documents.
The grammar must stay aligned with the shared conformance/manifest.sdif fixture suite in the sdif-spec repository. Changes to SDIF syntax that affect the specification should be reflected here.
The corpus in test/corpus/core.txt covers:
- directives (
@sdif,@schema,@include) - header fields
- table declarations with column lists and cell rows
- relation blocks
- rules blocks
.sdif.aicompact table syntax, including$-suffixed string-preserved columns- comments
The queries/highlights.scm file maps grammar nodes to standard capture names. It is the starting point for editor syntax highlighting. Integrations using Neovim, Helix, Zed or other Tree-sitter-aware editors can consume it directly.
This GitHub organization hosts the official SDIF ecosystem: the core format, reference tooling, benchmarks, examples, libraries, and editor extensions.
|
PYTHON CLIENT & CLI
Specification, parser, canonicalizer, and CLI. |
SPECIFICATION (SSOT)
Official format specification, canonicalization rules, |
BENCHMARKS Reproducible benchmark datasets and reports comparing SDIF with JSON, YAML, XML, and CSV. |
|
RUST IMPLEMENTATION Pure Rust parser implementation with a span-annotated AST designed for editor tooling. |
LANGUAGE SERVER (LSP) LSP language server binary (tower-lsp) providing real-time diagnostics and IDE features. |
EDITOR INTEGRATION VS Code extension client providing syntax highlighting, diagnostics, and LSP configuration. |
|
GRAMMAR FOUNDATION Tree-sitter grammar foundation for syntax highlighting and incremental parsing. |
DOCUMENTATION Official documentation website containing specification guides, tutorials, and examples. |
ORGANIZATION META Organization profile, assets, and shared community configuration files. |
Repository map
| Repository | Purpose |
|---|---|
sdif-py |
Core Python parser, validator, canonicalizer, and CLI |
sdif-spec |
Official format specification and conformance test suite (SSOT) |
sdif-benchmarks |
Benchmark datasets, reports, and comparison tooling |
sdif-rs |
Rust parser crate with span-annotated AST |
sdif-lsp |
LSP language server binary |
tree-sitter-sdif |
Tree-sitter grammar foundation for syntax highlighting |
vscode-sdif |
VS Code extension client for SDIF |
sdif-format.github.io |
Public documentation website (Docusaurus) |
.github |
Organization profile, assets, and shared GitHub community files |
MIT. See LICENSE.
