Skip to content

hyperpolymath/tree-sitter-a2ml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tree-sitter-a2ml

Tree-sitter grammar for the A2ML (Attestation and Automation Markup Language) format.

License: PMPL-1.0-or-later Tree-sitter A2ML

What this is

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.

Quick start

# Regenerate the parser from grammar.js
just generate

# Run corpus tests
just test

# Build language bindings (Node.js, Python, Rust)
just build-bindings

Grammar overview

A2ML 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_pairkey: value pairs

  • attestation_block — multi-line attestation content

  • list_item- item or * item lines

  • comment# comments

  • blank_line

Editor integration

The queries/ directory provides:

File Purpose

queries/highlights.scm

Maps grammar nodes to standard tree-sitter capture names (@comment, @markup.heading, @property, @string, etc.) for syntax highlighting in Neovim, Helix, Zed, and Emacs

queries/locals.scm

Scope and reference captures (minimal for A2ML’s flat model)

Deno integration

import { parser } from "jsr:@hyperpolymath/tree-sitter-a2ml";

const tree = parser.parse(source);
// tree.rootNode.children → array of A2ML top-level nodes

File map

Path What it contains

grammar.js

Authoritative grammar source — all rules, precedences, node types

src/parser.c

Generated C parser (do not edit — regenerate with just generate)

src/grammar.json

Serialised grammar for tree-sitter CLI and binding generators

src/node-types.json

Node type manifest consumed by binding generators

queries/highlights.scm

Syntax highlighting captures

queries/locals.scm

Scope and reference captures

bindings/

Auto-generated: Node.js, Python, Rust

binding.gyp

Node.js native addon build descriptor

deno.json

Deno module manifest with JSR export

test/

Tree-sitter corpus tests (.txt input/expected pairs)

tests/

Extended integration tests against real A2ML files

A2ML across the account

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.

License

PMPL-1.0-or-later. See LICENSE.

Author

Jonathan D.A. Jewell
j.d.a.jewell@open.ac.uk

About

Tree-sitter grammar for the A2ML (Attestation & Automation Markup Language) format

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors