⚠️ Alpha. Orbit's syntax is still evolving; this grammar tracks it and changes alongside it. Node names and fields may shift between commits.
This repository defines the tree-sitter grammar for Orbit — the concrete
parser that turns .orb source into a syntax tree. It is the parsing engine
behind the official Orbit extension for Zed,
and can be reused by any tree-sitter host (Neovim, Emacs, Helix, a future
language server, CLI tooling, etc.).
It is a component, not an end-user product: on its own it does nothing visible. Editors and tools consume it to get accurate syntax trees, on top of which they build highlighting, indentation, folding, structural navigation, and more.
The grammar covers the full current surface of Orbit, including:
- The complete literal set — integers (dec/hex/oct/bin, signed & unsigned),
floats, chars, normal / raw (
r"…") / bytes (b"…") strings, atoms (@name), booleans,nil - Classes, traits,
impl,init/cleanup, visibility (pub/prot/weak),const/asyncmodifiers, decorators (@[ … ]) - Functions with default / keyword / variadic parameters, anonymous functions
- Control flow —
if/elif/else,loop,for … in,switchwithfallthrough, labeled loops,defer,try/catch/finally,sync - Concurrency —
spawn,await, channel send/receive (<-), pipelines (|>) - Null-safety operators (
?.,??,?:) and a precedence-correct expression grammar (Pratt-style, mirroring the language's operator precedences) - FFI — both single
native func … from "lib"declarations and the groupednative from "lib" { … }block form - Modules —
importwith aliasing and selective imports
ts-orbit/
├── grammar.js # the grammar definition (edit this)
├── package.json # tree-sitter package metadata
└── src/ # GENERATED — do not edit by hand
├── parser.c # the generated parser
├── grammar.json # grammar in JSON form
├── node-types.json
└── tree_sitter/ # runtime headers
grammar.js is the single source of truth. Everything under src/ is produced
by the tree-sitter CLI and committed so that consumers (like Zed) can compile
the parser without a JS toolchain.
You don't use this repo directly — the Orbit Zed extension
references a specific commit of it in its extension.toml and compiles it to
WebAssembly automatically.
Point your host at this grammar the way it expects (a git dependency, a
submodule, or a local path). The generated src/parser.c and the query files
provided by each editor integration are all that's needed.
After editing grammar.js:
npx tree-sitter-cli generateThis rewrites everything under src/. Commit grammar.js and the
regenerated src/ together — consumers pin an exact commit, so the two must
always match.
For the Zed extension: after regenerating and committing here, bump the
commithash in the extension'sextension.tomlto this repo's newHEAD, then reinstall the dev extension so Zed recompiles the grammar.
Actively developed alpha, kept in lockstep with the Orbit language. Parser
generation is warning-free and validated against representative .orb sources
covering every construct above.
This grammar is fully AI-managed: grammar.js, the regenerated parser, and
this documentation are authored and kept in sync with the Orbit language by an
AI workflow, tracking every feature the language currently supports.
Licensed under the Apache License 2.0. See LICENSE.