Skip to content

Commit 168a9b9

Browse files
committed
docs: substantive CRG C annotation (EXPLAINME.adoc)
1 parent d476f37 commit 168a9b9

1 file changed

Lines changed: 45 additions & 12 deletions

File tree

EXPLAINME.adoc

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,65 @@
1-
// SPDX-License-Identifier: PMPL-1.0-or-later
1+
// SPDX-License-Identifier: MPL-2.0
22
= a2ml_ex — Show Me The Receipts
33
:toc:
44
:icons: font
55

66
The README makes claims. This file backs them up.
77

8-
[quote, README]
9-
____
10-
A2ML is a structured markup language with built-in attestation provenance, directive metadata, and trust-level tracking. This library provides a complete parser and renderer for A2ML documents in pure Elixir.
11-
____
8+
== Real Claims From The README
9+
10+
**Claim 1: "Parse A2ML documents from strings or files… Render AST back to A2ML surface syntax (round-trip support)"** (README, Features section)
11+
12+
The parser in `lib/a2ml/parser.ex` reads A2ML-formatted text and emits a typed AST via `A2ML.Parser.parse/1`, which returns `{:ok, Document.t()}` or `{:error, reason}`. The parser extracts:
13+
14+
* Title from H1 heading (`# Title`)
15+
* Blocks (paragraphs, headings, code blocks, directives, attestations)
16+
* Directives starting with `@` (e.g., `@include(file="chapter1.a2ml")`)
17+
* Attestation provenances blocks starting with `!attest`
18+
19+
The renderer in `lib/a2ml/renderer.ex` reconstructs the surface syntax from the AST via `A2ML.Renderer.render/1`, returning `{:ok, rendered_string}`. This enables round-trip: parse → modify AST → render produces valid A2ML again.
20+
21+
*How it works:* The parser splits input by newlines, identifies block boundaries, and classifies each line. The `Attestation` struct stores identity, role, trust level, and timestamp. Directives are key-value pairs in `@name(key=val): value` syntax. The renderer walks the AST and reconstructs each element. Caveat: Whitespace normalization and comment stripping mean the rendered output may not be byte-for-byte identical to the input, though semantic content is preserved.
22+
23+
**Claim 2: "Trust-level hierarchy: :unverified, :automated, :reviewed, :verified"** (README, Trust Levels section)
24+
25+
The `A2ML.Types.TrustLevel` enum in `lib/a2ml/types.ex` defines a four-tier hierarchy. The parser extracts trust level from attestation blocks (`trust-level: verified`) and stores it on the `Attestation` struct. The types module enforces the hierarchy: `:unverified` < `:automated` < `:reviewed` < `:verified`. Document-wide trust is derived from the minimum trust level of all attestations.
26+
27+
*How it works:* Attestation blocks declare `trust-level: <level>`. When rendering, the renderer includes the trust level in the output. Clients can filter documents by minimum trust requirement. Caveat: Trust levels are advisory metadata—the library does not cryptographically verify signatures. Signature verification (mentioned in the README's example) is a future feature; currently `signature:` field is stored as a string literal without validation.
28+
29+
== Dogfooted Across The Account
30+
31+
a2ml_ex is part of the A2ML ecosystem, which includes:
32+
33+
* link:https://github.com/hyperpolymath/a2ml-deno[a2ml-deno] — Deno/ReScript implementation (primary)
34+
* link:https://github.com/hyperpolymath/tree-sitter-a2ml[tree-sitter-a2ml] — Tree-sitter grammar for syntax highlighting
35+
* link:https://github.com/hyperpolymath/a2ml-haskell[a2ml-haskell] — Haskell implementation
36+
* link:https://github.com/hyperpolymath/standards[standards] — A2ML spec (K9 service specification)
37+
38+
The Elixir implementation enables A2ML parsing in BEAM-based systems (Elixir, Erlang). It follows the same type structure as the Deno version.
1239

1340
== Technology Choices
1441

15-
[cols="1,2"]
42+
[cols="1,2,3"]
1643
|===
17-
| Technology | Learn More
44+
| Technology | Learn More | Why
1845

19-
| **Elixir** | https://elixir-lang.org
46+
| **Elixir** | https://elixir-lang.org | BEAM runtime, immutable data structures, pattern matching for AST
47+
| **ExUnit** | https://hexdocs.pm/ex_unit | Testing framework (no external test dependency)
48+
| **Hex.pm** | https://hex.pm | Package distribution (MPL-2.0 requirement for Hex ecosystem)
2049
|===
2150

2251
== File Map
2352

24-
[cols="1,2"]
53+
[cols="1,2,3"]
2554
|===
26-
| Path | What's There
55+
| Path | What's There | Key Details
2756

28-
| `lib/` | Library code
29-
| `test(s)/` | Test suite
57+
| `lib/a2ml/parser.ex` | A2ML text parser | Reads lines, extracts title, parses blocks, directives, attestations
58+
| `lib/a2ml/renderer.ex` | AST-to-text renderer | Reconstructs A2ML surface syntax from `Document` struct
59+
| `lib/a2ml/types.ex` | Type definitions | `Document`, `Block`, `Inline`, `Directive`, `Attestation`, `TrustLevel` structs
60+
| `lib/a2_ml.ex` | Public API | Re-exports parser and renderer functions
61+
| `test/a2ml_test.exs` | Parser tests | Round-trip tests, edge cases, error handling
62+
| `mix.exs` | Build configuration | Elixir version, Hex metadata, dependencies
3063
|===
3164

3265
== Questions?

0 commit comments

Comments
 (0)