|
5 | 5 |
|
6 | 6 | The README makes claims. This file backs them up. |
7 | 7 |
|
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. |
12 | 25 |
|
13 | 26 | == Technology Choices |
14 | 27 |
|
15 | 28 | [cols="1,2"] |
16 | 29 | |=== |
17 | 30 | | Technology | Learn More |
18 | 31 |
|
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 |
20 | 35 | |=== |
21 | 36 |
|
22 | 37 | == File Map |
23 | 38 |
|
24 | | -[cols="1,2"] |
| 39 | +[cols="1,3"] |
25 | 40 | |=== |
26 | | -| Path | What's There |
| 41 | +| Path | Purpose |
27 | 42 |
|
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 |
30 | 55 | |=== |
31 | 56 |
|
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 |
33 | 65 |
|
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