Skip to content

Commit 198dcd6

Browse files
committed
docs: substantive CRG C annotation (EXPLAINME.adoc)
1 parent dbcc33b commit 198dcd6

1 file changed

Lines changed: 43 additions & 11 deletions

File tree

EXPLAINME.adoc

Lines changed: 43 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,62 @@
55

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

8-
[quote, README]
9-
____
10-
A hyperpolymath project.
11-
____
8+
== Claims Substantiation
9+
10+
=== Claim 1: "Full A2ML parser with error reporting, manifest extraction, and roundtrip fidelity (parse then render preserves structure)"
11+
12+
**How it works:** The Gleam parser (`src/a2ml/parser.gleam`) implements recursive descent parsing over A2ML syntax: headings, paragraphs, directives, attestation blocks, trust levels. Each parse rule returns `Result(Parsed, ParseError)`, enabling error accumulation and recovery (e.g., malformed directive doesn't crash, returns error with position). The renderer (`src/a2ml/renderer.gleam`) walks the AST and emits A2ML text. Roundtrip testing (parse text T, render AST, compare output) validates that structure is preserved. Manifest extraction (`src/a2ml/manifest.gleam`) queries the AST for specific directive blocks (e.g., all `@version` directives) without reparsing.
13+
14+
**Caveat:** Error recovery is best-effort. Deep nesting or circular references may cause panics. Trust-level validation is structural only (checks enum values); cryptographic verification is external. Manifest extraction is key-based lookup, not full XPath-like queries.
15+
16+
**Evidence:** `src/a2ml/parser.gleam` implements `parse(text: String) -> Result(Document, ParseError)` with error position tracking. `src/a2ml/renderer.gleam` implements `render(doc: Document) -> String`. Tests in `test/` verify round-trip on realistic A2ML documents.
17+
18+
=== Claim 2: "Pure Gleam library targeting Hex.pm ecosystem (BEAM and JavaScript compilation)"
19+
20+
**How it works:** Gleam code compiles to either Erlang bytecode (running on BEAM) or JavaScript (targeting Node.js, Deno, browsers via JavaScript backend). The library has no platform-specific code—it uses only Gleam stdlib (which abstracts over BEAM/JS differences). When published to Hex.pm, the Gleam compiler automatically detects both backends and builds for both. Users can import `a2ml_gleam` in their BEAM-based Elixir/Erlang projects OR in JavaScript-based Gleam projects—same library, two runtimes.
21+
22+
**Caveat:** BEAM and JavaScript have different performance characteristics. The BEAM version may be faster for parsing large documents (concurrent processes), while JavaScript is lighter for simple applications. Some stdlib functions have slightly different semantics across platforms (error types, garbage collection). The library must avoid platform-specific idioms to maintain parity.
23+
24+
**Evidence:** `gleam.toml` specifies Gleam version and Hex.pm metadata. No `#[cfg]` or platform conditionals in code. CI tests both `gleam build` (BEAM) and `gleam build --target javascript`. Hex.pm publishes both built artifacts.
1225

1326
== Technology Choices
1427

1528
[cols="1,2"]
1629
|===
1730
| Technology | Learn More
1831

19-
| **Gleam** | https://gleam.run
32+
| **Gleam** | Functional language compiling to Erlang/JavaScript
33+
| **BEAM** | Erlang VM (concurrency, fault tolerance)
34+
| **Hex.pm** | Erlang/Elixir package registry
2035
|===
2136

2237
== File Map
2338

24-
[cols="1,2"]
39+
[cols="1,3"]
2540
|===
26-
| Path | What's There
41+
| Path | Purpose
2742

28-
| `src/` | Source code
29-
| `test(s)/` | Test suite
43+
| `src/a2ml/` | Core modules
44+
| `src/a2ml/types.gleam` | Type definitions: Document, Block, Inline, Directive, Attestation, TrustLevel
45+
| `src/a2ml/parser.gleam` | Recursive descent parser: text → Result(Document, ParseError)
46+
| `src/a2ml/renderer.gleam` | AST → text: walk tree, emit A2ML syntax
47+
| `src/a2ml/manifest.gleam` | Manifest extraction: query AST for specific directives
48+
| `src/a2ml.gleam` | Main module: re-exports public API
49+
| `test/` | Test suite
50+
| `test/parser_test.gleam` | Parser unit tests: all syntax forms, error cases
51+
| `test/renderer_test.gleam` | Renderer tests: round-trip fidelity
52+
| `test/manifest_test.gleam` | Manifest extraction tests
53+
| `gleam.toml` | Package manifest: name, version, dependencies, exports
54+
| `README.md` | User documentation with examples
3055
|===
3156

32-
== Questions?
57+
== Dogfooted Across The Account
58+
59+
| Project | Integration |
60+
| **panic-attacker** | Can parse Elixir projects' A2ML manifests via BEAM backend
61+
| **ephapax** | Attestation blocks in A2ML can be linearly typed in Ephapax
62+
| **burble** | Audio metadata could be annotated with A2ML trust levels
63+
64+
== Readiness
3365

34-
Open an issue or reach out directly — happy to explain anything in more detail.
66+
**CRG Grade:** C (Beta) - Parser and renderer working across BEAM and JavaScript, roundtrip tested, Hex.pm integration ready. Production-ready for manifest parsing; advanced features (recursive queries, cryptographic verification) future work.

0 commit comments

Comments
 (0)