tree-sitter-a2ml provides a generated C parser for A2ML — the hyperpolymath
machine-readable metadata format used in AI manifests (0-AI-MANIFEST.a2ml),
contractile trustfiles, STATE/META/ECOSYSTEM checkpoint files, and CI/CD
attestation blocks.
A tree-sitter parser enables syntax-aware operations in any tree-sitter-aware editor (Neovim, Helix, Zed, Emacs with combobulate) and in tooling that imports the generated bindings.
# Regenerate the parser from grammar.js
just generate
# Run corpus tests
just test
# Build language bindings (Node.js, Python, Rust)
just build-bindingsA2ML is a line-oriented format. The grammar’s top-level document rule
recognises eight node types:
-
section_delimiter—---on its own line -
section_heading—# [BRACKET_FORM]headings -
subsection_heading— plain text headings -
key_value_pair—key: valuepairs -
attestation_block— multi-line attestation content -
list_item—- itemor* itemlines -
comment—#comments -
blank_line
The queries/ directory provides:
| File | Purpose |
|---|---|
|
Maps grammar nodes to standard tree-sitter capture names
( |
|
Scope and reference captures (minimal for A2ML’s flat model) |
import { parser } from "jsr:@hyperpolymath/tree-sitter-a2ml";
const tree = parser.parse(source);
// tree.rootNode.children → array of A2ML top-level nodes| Path | What it contains |
|---|---|
|
Authoritative grammar source — all rules, precedences, node types |
|
Generated C parser (do not edit — regenerate with |
|
Serialised grammar for tree-sitter CLI and binding generators |
|
Node type manifest consumed by binding generators |
|
Syntax highlighting captures |
|
Scope and reference captures |
|
Auto-generated: Node.js, Python, Rust |
|
Node.js native addon build descriptor |
|
Deno module manifest with JSR export |
|
Tree-sitter corpus tests ( |
|
Extended integration tests against real A2ML files |
Every hyperpolymath repo carries an 0-AI-MANIFEST.a2ml file.
tree-sitter-a2ml is the grammar that makes all of them syntax-aware in your
editor and in CI tooling.
See EXPLAINME.adoc for implementation evidence and caveats.
Jonathan D.A. Jewell
j.d.a.jewell@open.ac.uk