The tree-sitter grammar for the Fe language.
The grammar is defined in grammar.js, with a hand-written external scanner
in src/scanner.c. These are the only sources tracked in git.
The tree-sitter CLI compiles grammar.js into a parser. Those outputs are
not tracked in git (they're large build artifacts that bloat diffs — a small
grammar change can rewrite tens of thousands of lines of parser.c):
src/parser.csrc/grammar.jsonsrc/node-types.jsonsrc/tree_sitter/(runtime headers emitted by the CLI)
They are regenerated from grammar.js automatically.
cargo build / cargo test regenerate src/parser.c on demand via
bindings/rust/build.rs whenever it is missing or grammar.js is newer. This
requires a tree-sitter CLI:
-
Preferred (pinned, reproducible): install the version pinned in
package-lock.jsonintonode_modules/:npm ci --ignore-scripts # installs deps without the unused Node addon build npm rebuild tree-sitter-cli # fetches the pinned tree-sitter CLI binary
build.rsprefersnode_modules/.bin/tree-sitterwhen present. -
Fallback: any
tree-sitterCLI on yourPATH(output may differ slightly by CLI version, but--abi=14keeps it compatible with thetree-sitter0.24.x runtime).
From the repo root, make test performs the pinned-CLI generation and then runs
the workspace test suite, including the grammar test
(crates/parser/tests/tree_sitter_parse.rs, which parses every .fe fixture
against the freshly generated grammar). CI performs the same generation step
before building.