- C 75%
- JSON 21.5%
- JavaScript 2.3%
- Scheme 1%
- Markdown 0.3%
tree-sitter-piton
Generated by piton grammar. Build it with:
npm install
npx tree-sitter generate
npx tree-sitter parse ../../examples/*.pi
The grammar is deliberately line-oriented. Piton is indentation-structured, and
tracking INDENT/DEDENT in Tree-sitter needs an external scanner; every
consumer of this grammar wants it for highlighting, folding, and indent
heuristics, all of which work per line. Structural questions — resolution,
inheritance, diagnostics — are answered by piton lsp, which uses the real
compiler grammar.
Where this comes from
This directory is generated from the Piton compiler and published as its own
repository at ssh://dev.mdynx.net/piton/tree-sitter-piton.git, because Zed, Helix, and nvim-treesitter all fetch
grammars over git. The Piton repository is the source of truth; run
cargo xtask publish-grammar there rather than committing here.
src/ holds the output of tree-sitter generate and is committed on purpose:
the editors that consume this grammar compile src/parser.c, they do not run
the Tree-sitter CLI.