Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/babel/blob/main/README.md # babel aien-dev/babel Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `babel / README.md` 173 lines · 13441 bytes Raw Blame History Rendered 1 # babel 2 3 `babel` translates code through **Omega**, the explicit computational language of [AienOS](https://www.aienos.com). You point it at a folder. It writes the translation next to the folder: the input, the Omega form and the target language. It also writes a report that accounts for every function and every declaration in the input. 4 5 ``` 6 $ babel examples/sample --to rust 7 ``` 8 9 ``` 10 examples/sample.babel/ 11 input/ byte copy of every input file (sha256 recorded while copying) 12 omega/ one Omega unit per translated function, plus manifest.json 13 rust/ the target project (Cargo crate, differential test, driver) 14 diff// vectors.txt, oracle.c, driver.om, c-original.out, omega.out, target.out 15 REPORT.md per-file, per-item verdicts with reasons and line ranges 16 report.json the same, schema babel.report.v1 17 ``` 18 19 With no `--to` and a terminal on stdin, babel asks for the target language. `--json` prints `report.json` on stdout instead of the summary table. `--complete` makes the exit status follow the completion record (see [Completion](#completion)). `--exclude FILE` names a manifest of non-source entries that are excluded from completion with a reason (see [Exclusion manifest](#exclusion-manifest)). 20 21 **Status: pre-alpha.** Only one narrow profile is implemented, and anything outside it is refused by name. The [ROADMAP](ROADMAP.md) is PROPOSED work, not a feature list. 22 23 ## What is supported today 24 25 Profile **S1 `c17-uint64-pure-v1`**: C17 functions whose parameters and result are `uint64_t`. Up to 6 parameters; the body is a pure arithmetic expression. Arithmetic wraps modulo 2^64, as in C. These are the adapters of [aien-dev/omega-mv](https://github.com/aien-dev/omega-mv) #624, pinned at `universal/624-g1-integration` ``2d4c6407``. 26 27 | From \ to | rust | c | python | cpp | zig | go | 28 |---|---|---|---|---|---|---| 29 | C17, S1 functions | EXERCISED | EXERCISED | EXERCISED | EXERCISED | EXERCISED | EXERCISED | 30 | C: anything else (globals, structs, pointers, branches, calls, libc, preprocessor) | refused | refused | refused | refused | refused | refused | 31 | Python, Rust, C++, Zig, Go input | MISSING_IMPLEMENTATION | ← | ← | ← | ← | ← | 32 33 EXERCISED means that `tests/run.sh` ran on `examples/sample` on an arm64 Linux host. Each of the six targets gave 5 TRANSLATED, 7 UNSUPPORTED, 5 MISSING_IMPLEMENTATION, 0 FAIL and 2 ABSORBED. CI repeats this on a GitHub `ubuntu-24.04-arm` runner. That is host evidence: it is not hardware qualification, and it is not a release. 34 35 The omega-mv `-import` adapters exist for Rust, Python, C++, Zig and Go, one function per unit. Babel has no splitter for those languages, so their files are reported MISSING_IMPLEMENTATION with that reason. Babel does not guess. 36 37 ## Verdicts 38 39 | Verdict | Meaning | 40 |---|---| 41 | TRANSLATED | The adapter exited 0, the pinned omc accepted the Omega unit, and **the original C, the Omega unit and the target output are byte-identical on every vector**. | 42 | UNSUPPORTED(rc) | An adapter refused the function with a profile exit code. The codes are 64 name, 65 syntax, 66 type, 67 limit, 68 arithmetic, 69 construct, 70 unknown identifier, 71 signature and 72 preprocessor. | 43 | MISSING_IMPLEMENTATION | Nothing in the pipeline handles this item: C declarations, preprocessor lines, other languages. The reason names the item. | 44 | FAIL | A stage ran and disagreed: an output differed on a vector, a build failed, or the oracle failed. Babel exits 1. | 45 | NOT_RUN | A required toolchain is absent, so the check did not happen. It does not count as a pass. A `ZIG=` or `GO=` path that is not executable counts as absent. | 46 | ABSORBED | `#include `: the S1 profile header, which babel supplies to every unit. | 47 | SKIPPED | Completion record only: an entry the walk did not enter (hidden entry, symbolic link, other non-regular file, `*.babel` folder, unreadable directory). | 48 | EXCLUDED | Completion record only: a non-source file or skipped entry named by the `--exclude` manifest, with the manifest's reason. | 49 50 The vectors are the boundary values {0, 1, 2, 2^32−1, 2^32, 2^63−1, 2^63, 2^64−2, 2^64−1}. Functions of arity ≤ 3 get the full cross product; higher arities get 81 rows. Every function also gets 64 splitmix64 vectors from seed `20261026`. The original C function is compiled verbatim by `cc` as the oracle. Babel never stores or replays source: every target file is adapter output. 51 52 ## Completion 53 54 Every run computes a completion record, policy `complete-v1`, and writes it to `report.json` (`"completion"`), to a "Completion" section of REPORT.md and to one summary line. Its denominator counts: 55 56 - every walked file (a file in a language babel does not recognise, such as `README.txt`, is open as MISSING_IMPLEMENTATION); 57 - every split item (TRANSLATED, ABSORBED, UNSUPPORTED, MISSING_IMPLEMENTATION, FAIL, NOT_RUN); 58 - every SKIPPED entry, each listed by path; 59 - every required check: the three differential legs (original C, Omega, target) of each unit that reached the differential, the generated target test for rust and python, and each toolchain the target needs (`cc` for the oracle plus the target's own). 60 61 The state is the first that applies: 62 63 | State | Condition | 64 |---|---| 65 | FAILED | Any FAIL item or check, including a failed generated test. | 66 | BLOCKED | No FAIL, but a required check is NOT_RUN or a toolchain is missing. | 67 | PARTIAL | No FAIL and no NOT_RUN, but UNSUPPORTED, MISSING_IMPLEMENTATION or SKIPPED items remain. | 68 | COMPLETE | Every item TRANSLATED, ABSORBED or EXCLUDED (covered + excluded == denominator), nothing open, every required check ran and passed. | 69 70 ``` 71 "completion": {"policy": "complete-v1", "enforced": false, "state": "PARTIAL", "denominator": 39, "covered": 26, 72 "open": [{"kind": "unit", "item": "src/mix.c:15-17", "name": "zero", "verdict": "UNSUPPORTED(68)", "reason": "..."}, ...]} 73 ``` 74 75 `kind` is `file`, `unit`, `skipped`, `check` or `toolchain`; `item` is `path:line[-line]` for units and their legs, a path for files and skipped entries, and a tool name for toolchains. `enforced` is true under `--complete`. `examples/sample` is PARTIAL (26 of 39); `examples/complete` (three S1 functions and the stdint include) is COMPLETE. `excluded_count`, `excluded` and `manifest` are always present: without `--exclude` they are `0`, `[]` and `null`. 76 77 ### Exclusion manifest 78 79 `--exclude FILE` reads a manifest of entries that are not source and need no translation, such as documentation or VCS metadata: 80 81 ``` 82 # ; blank lines and # lines are ignored 83 README.txt notes for people, no code 84 .gitignore VCS metadata 85 docs/ prose only 86 ``` 87 88 Each entry is a path relative to the walked root: an exact path, or a directory prefix (`docs/` covers everything below `docs`). Globs are refused. A matched item stays in the denominator with verdict EXCLUDED and is listed under `"excluded"` with its `reason`, `matched_by` (the entry) and manifest `line`; it is not counted as covered. The summary line shows `C of D items covered, X excluded by manifest `, and REPORT.md lists the excluded items with the manifest path and full sha256: 89 90 ``` 91 "excluded_count": 1, "excluded": [{"kind": "file", "item": "README.txt", "verdict": "EXCLUDED", "reason": "notes for people, no code", "matched_by": "README.txt", "line": 2}], 92 "manifest": {"path": "babel.exclude", "sha256": "...", "walked_as": "babel.exclude"} 93 ``` 94 95 A manifest inside the walked tree is itself counted as covered (`walked_as` is its walked path; `null` when it lies outside). Babel exits 2, before it writes any output folder, with one `babel: --exclude FILE line N: ...` diagnostic per bad line, when an entry 96 97 - has no reason; 98 - is a glob; 99 - matches nothing in the walked tree (a stale manifest); 100 - names an entry babel splits as source, including a hidden or symbolically linked `.c` file: source cannot be excluded, only translated or left open. 101 102 `tests/run.sh` checks all of this independently of babel: 103 104 - `cmp` on the three outputs; 105 - line counts against the vector count; 106 - `python3 -m json.tool` on both JSON outputs; 107 - a **negative control**: a `cc` wrapper changes `fold`'s original C (`- k` to `+ k`) only when compiling the oracle. Babel must then report FAIL ("differs from the original C on 127 of 145 vectors") and exit 1; 108 - the completion gate: `examples/sample --complete` is PARTIAL and exits 3; `examples/complete --complete` is COMPLETE and exits 0 (c and rust); the same input plus one hidden file, or plus one symbolic link, is PARTIAL and exits 3 with that entry as the only open item; the `cc` wrapper under `--complete` is FAILED and exits 1; `ZIG=/nonexistent --to zig --complete` is BLOCKED and exits 4; 109 - the remaining completion gaps: a FIFO, or a mode-000 directory, is the only open item (PARTIAL, exit 3); a `PATH` without `cc` is BLOCKED (exit 4); a `cargo` that fails only `cargo test` is FAILED (exit 1) with the generated test as the only open item; 110 - the exclusion manifest: `examples/complete` plus `README.txt` is PARTIAL (exit 3) and COMPLETE (exit 0) with `README.txt` excluded, same denominator; an in-tree manifest plus an excluded `.gitignore` is COMPLETE; manifests naming `src/arith.c`, `src/`, a hidden `.c`, a symlinked `.c`, a stale path, a glob, or an entry without a reason each exit 2 without an output folder. 111 112 ## Why Omega is the middle 113 114 Translating between N languages directly needs N×M translators. Going through one intermediate language needs N front-ends and M back-ends. This is the old UNCOL idea (1958). UNCOL failed because its intermediate form was pseudo-assembly: it either lost the source semantics or bloated into the union of every machine. 115 116 Babel uses Omega as the middle on a different basis: 117 118 - **Omega carries semantics, not instructions.** An imported function becomes a typed Omega unit with an explicit arithmetic contract: u64 wrapping. The pinned compiler checks that unit, and it is run as one of the three differential legs. 119 - **Every target has a realization contract.** A back-end may emit only constructs whose meaning matches the Omega unit. Anything without a contract is refused. Nothing is approximated. 120 - **Effects are explicit.** S1 is pure, so I/O, globals and pointers are refused at import rather than translated loosely. Wider profiles must name their effects before a target can realize them. 121 - **Every claim is checked.** No unit is called TRANSLATED until all three legs agree byte for byte. 122 123 ## Build and run 124 125 Requirements, recorded in [DEPENDENCIES.md](DEPENDENCIES.md): 126 127 - an aarch64 Linux host; 128 - a clone of [aien-dev/omega-mv](https://github.com/aien-dev/omega-mv) with the adapters built; 129 - the target toolchains. 130 131 ``` 132 git clone https://github.com/aien-dev/omega-mv && git clone https://github.com/aien-dev/omega-bridge 133 (cd omega-mv && git checkout `2d4c640702c82b8deb8a296407aadf660dac7fc7` && \ 134 make -f mk/translation.mk test-translation-g3 SA_SEED_REPO=$PWD/../omega-bridge OMEGA_BRIDGE_REPO=$PWD/../omega-bridge) 135 OMEGA_MV=$PWD/omega-mv ./build.sh # build/babel, compiled by the pinned omc 136 BABEL_ADAPTERS=$PWD/omega-mv build/babel examples/sample --to go 137 BABEL_ADAPTERS=$PWD/omega-mv tests/run.sh # ZIG=/GO= if not on PATH 138 ``` 139 140 Babel refuses to run unless the adapters' native omc has sha256 ``734f0a39`…6b61`. Re-running babel replaces `input/`, `omega/`, `diff/` and the folder for the chosen language. Folders for other languages are kept. Hidden entries, symlinks and `*.babel` folders are not walked; each is counted and listed as SKIPPED in the completion record. 141 142 Exit codes: 143 144 | Code | Without `--complete` | With `--complete` | 145 |---|---|---| 146 | 0 | No FAIL | COMPLETE | 147 | 1 | At least one FAIL, or the generated test failed | FAILED | 148 | 2 | Usage or environment error, or a rejected `--exclude` manifest | same | 149 | 3 | not used | PARTIAL | 150 | 4 | not used | BLOCKED | 151 | 64 | No `--to` and no terminal | same | 152 153 ## Implementation 154 155 Babel itself is written in Omega (`src/*.om`, 6,469 lines). It walks files, hashes them, splits C top-level items, spawns the adapters and toolchains, generates the projects and drivers, compares outputs and writes the reports. 156 157 The only shell is in `build.sh` and `tests/run.sh`, which coordinate the build and run independent checks. Host programs babel launches are listed in [DEPENDENCIES.md](DEPENDENCIES.md), each with its Omega replacement. 158 159 ## Licence 160 161 Apache-2.0 with the LLVM exception ([LICENSE](LICENSE), [NOTICE](NOTICE)). `build.sh` compiles babel's source together with two Apache-2.0 files from aien-dev/omega-mv at ``0b77e6ea2``: the OM-2 compiler `seed/out/omc` and the SHA-256 unit `om/sha256/sha256-om2.om`. It checks the sha256 digest of both files. 162 163 ## Human-Directed Agentic Engineering 164 165 Development follows Human-Directed Agentic Engineering (HDAE): humans define goals, 166 architecture, constraints, acceptance criteria, and stopping points; agents implement, 167 execute checks, diagnose failures, and revise within those boundaries. Human review 168 retains responsibility for claims, acceptance, and release decisions. 169 170 For the documented method and a systems-software case study, see Gregory M. Kurtzer, 171 [*Ginux: Building an Independent Kernel That Runs Linux Userspace through 172 Human-Directed Agentic Engineering* (2026)](https://doi.org/10.5281/zenodo.`23682548`). 173 This citation describes the development method, not runtime autonomy or an endorsement.