How Omega Bridge works, and how it was built
This page is for an engineer who has not seen the project before. It explains the problem, the mechanism and the design choices, and records one approach that failed. It ends with a recipe you can run offline from a fresh checkout. Every claim links to the file it comes from.
Revision described: main at 7af4d11c3a9c853abc20a99f97d0a4f01524bb66.
The problem
Omega programs compile to AArch64 machine code with the seeded Omega compiler, which has no outside toolchain. That keeps Omega trustworthy, but an existing C or Python application cannot use an Omega function unless something connects the two. The goal recorded in DESIGN.md is to let existing languages and tools adopt Omega with as little change as possible, and to say exactly what is supported instead of claiming that any language translates perfectly.
The mechanism
There are two separate routes. Do not confuse them.
- Conversion (src/toc.om). A bounded subset of Omega is turned into GNU C11 or Python 3 source. The generated program prints the same output, exits with the same status and traps with the same code as the natively compiled Omega program.
- Native call bindings (src/native.om, NATIVE-ABI.md). These leave the program as Omega machine code in a shared library and generate the header or module that C, C++, Python, Rust, Zig or Go needs to call it. Nothing is translated.
This walkthrough covers route 1. A conversion request goes through tools/bridge in this order:
- Check
build/compiler.sha256, so the converter binary matches its source. A mismatch exits 65. - Check that the seed compiler's SHA-256 is
191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9. A mismatch exits 65. - Copy the input once into a private temporary directory. Validation and generation both read that copy, so a file changed during the request cannot pass one step and fail the other.
- Compile the copy with the seed compiler as a whole-unit semantic check. If the seed rejects the program, nothing is emitted.
- Feed the copy to
build/bridge, the converter compiled fromsrc/toc.om. Its front end (lexer, name tables, two-pass signature scan;tok,namescanandwalk_siginsrc/toc.om) builds bounded typed expression nodes (node,expr,callnode). Separate writers then emit C or Python from those nodes (eexpr,eassign,efor,generate). This is code generation from parsed nodes, not text substitution (DESIGN.md, "Implemented architecture"). - Write the output to stdout only after the whole conversion succeeds. A refused feature exits with the compiler's error code and leaves stdout empty.
The generated code keeps Omega's observable rules: fixed-width arithmetic, arrays that carry their length, checked bounds, and defined traps. Python is made to wrap at fixed widths instead of using its unbounded integers. The full list of supported features and their limits is in CAPABILITIES.md. The calling convention for host programs is in ABI.md: every exported function returns a status code and writes its result through a pointer.
How it was built
- Recovered source, not a new compiler.
src/toc.ombegan as uncommitted Omega source,seed/toc/toc.omon omega base29b12760f4c962606411d6bf25032aedef063301. Its original digest is in RECOVERY.json, and its licence was kept (PROVENANCE.md). The lexer, tables and signature scan were kept and extended. The typed nodes and target writers replaced its unchecked emission (commits614f4ba,e24141fand7714900, 2026-10-22). - The pinned seed is the checker. The bridge does not have its own judgement of what is valid Omega. Every input first passes the pinned seed compiler (tools/bridge). The native, C and Python runs therefore share one front end. They are independent executions, not independent front ends (PROVENANCE.md).
- Exact source dependency. tools/bootstrap.sh fetches omega at the pinned commit, rebuilds the seed chain (seed0, hex1, asm2, om4, omc) from source and compares three omc stages. No compiler binary is stored in this repository.
- Opt-in only, rollback by not importing. Conversion writes to stdout and creates temporary files
under
build/. It never installs or replaces anything (DESIGN.md, "Adoption and efficiency"). To roll back, stop linking or importing the generated file. - Checks have no off switch. Library wrappers return errors as values. There is no flag that turns the bounds or alias checks off (DESIGN.md, decisions 29 and 30).
A failed approach: the recovered emitter as found
The first step was to run the recovered converter unchanged against the inherited test corpus. It failed 8 of 20 cases (evidence/01-recovered-red.log):
FAIL t_conv ('C mismatch', 105, 0, b'', b'', b'')
FAIL t_exit ('conversion', 16, b'toc: line 2: error 16\n')
FAIL t_ovf ('gcc', ... implicit declaration of function 'o_add_s' ...)
FAIL t_stack ('C mismatch', 106, -11, b'', b'', b'')
cases=20 failures=8 RC=1
The emitter copied source text through with too few checks. A conversion trap (exit 105) became a C
program that exited 0, and a stack trap (106) became a segmentation fault (-11). That is why the
emitter was replaced by typed nodes with separate writers instead of being patched case by case. A
second red run, evidence/22-inherited-text-red.log, showed
that the inherited text.om program was not covered. It is now refused explicitly (see the recipe
below).
Limitations
- The converters accept a bounded scalar subset plus read-only text constants. Floats, heap operations and other target languages are refused (CAPABILITIES.md). Converting Python or C into Omega is not implemented.
tools/bootstrap.shproves a fixpoint, not diverse double compilation. Both routes come from related seed code (DESIGN.md).- The source bootstrap needs Linux AArch64. Generated C needs a GNU C11 compiler and POSIX. Generated Python needs Python 3.
- No speed-up is claimed. Timings are recorded in
evidence/measurements.jsonwithout a speed claim.
Reproduce it
Offline part (no GPU, no model, no network after the fetch)
The host used for the run below: Linux 7.0.0-1019-nvidia aarch64, gcc 13.3.0, Python 3. The bootstrap
needs network access once, to fetch the pinned omega commit. To avoid that, point OMEGA_SOURCE at an
existing checkout.
git clone https://github.com/aien-dev/omega-bridge && cd omega-bridge
sh tools/bootstrap.sh # ends: bootstrap fixpoint RC=0, seed 191b776e...
sh tools/build.sh # writes build/bridge and build/compiler.sha256
The fetch URL in tools/bootstrap.sh still uses the old name, https://github.com/aien-spark/omega.git.
GitHub redirects it to aien-dev/omega-mv (checked
2026-11-04 with gh api repos/aien-spark/omega). The pinned commit and its hash checks do not depend on
the name. This page leaves the script unchanged, because AGENTS.md asks for review before any change to
the bootstrap supply chain.
Positive case. Convert tests/fixtures/fib.om to both targets and compare against the natively
compiled program:
build/bootstrap/omc < tests/fixtures/fib.om > build/fib.native && chmod +x build/fib.native
build/fib.native > build/fib.native.out
tools/bridge c tests/fixtures/fib.om > build/fib.c
gcc -std=gnu11 -O2 build/fib.c -o build/fib && build/fib > build/fib.c.out
tools/bridge python tests/fixtures/fib.om > build/fib.py && python3 build/fib.py > build/fib.py.out
sha256sum build/fib.*.out
Expected: all three exit 0, print the 26 Fibonacci numbers from 0 to 75025, and have the same hash,
327ac5f5a3f39c7248466ce0c5863fb988abbed4ab983eb2ac039ad86b06fddd.
The same trap in all three. tests/fixtures/t_div0.om divides by zero. Native, C and Python all
exit 102, as tests/fixtures/t_div0.want records.
A host caller. python3 tests/attachments.py converts examples/attachment.om, builds
examples/caller.c with UBSan and runs it and examples/caller.py:
C caller: values, mutation, traps, invalid lengths and recovery OK
Python caller: values, mutation, traps, invalid lengths and recovery OK
attachment cases=2 failures=0 RC=0
Refusal case. tests/unsupported/five_params.om is valid Omega; the native compiler accepts it. Its
function takes five scalar parameters, above the converter's four-parameter limit:
tools/bridge c tests/unsupported/five_params.om > build/five.c; echo rc=$?; wc -c < build/five.c
Expected: toc: line 1: error 24, unsupported bridge capability, rc=24, and 0 bytes of output.
Text case. tests/fixtures/text_program.om (the inherited seed text program) now converts: its
text becomes static const uint8_t g0[9]={97,9,98,92,99,34,100,10,101,}; in C and immutable bytes
in Python, and tests/differential.py checks both against the native program. python3 tests/text.py
runs the full text suite (exact bytes, refusals, bounds, library views, compiled mutants).
Negative control on the pin. A seed with one extra byte is refused before conversion:
cp build/bootstrap/omc /tmp/omc-tampered && printf '\0' >> /tmp/omc-tampered
OMEGA_SEED=/tmp/omc-tampered tools/bridge c tests/fixtures/fib.om; echo rc=$? # rc=65, no output
Full suite. sh tools/test.sh ends with ALL SUITES RC=0. The suite's lines include
cases=113 failures=0 RC=0 (differential), refusal cases=50 failures=0 RC=0,
control cases=7 failures=0 RC=0 and
robustness cases=225 target_accepts=6 target_refusals=444 failures=0 RC=0. It took 19 s on the host
above.
Optional parts (not needed for the recipe above)
- Native call bindings need
OMEGA_NATIVE_OMC, the seeded omega-mv compiler; see NATIVE-ABI.md. - The GPU adapter converts no host program. Device runs go through CUDA++ in an authorised hardware window; see GPU-ADAPTER.md and GPU-SUPPORT-MATRIX.md.
Source map
| What | Where |
|---|---|
| Conversion CLI and pin checks | tools/bridge |
| Converter (front end, typed nodes, C and Python writers) | src/toc.om |
| Seed bootstrap from pinned source | tools/bootstrap.sh |
| Native, C and Python differential tests | tests/differential.py, text: tests/text.py |
| Refusals | tests/refusals.py, tests/unsupported/ |
| Host callers | tests/attachments.py, examples/caller.c, examples/caller.py |
| Damaged-output controls | tests/controls.py |
| Design decisions | DESIGN.md |
| Supported features and limits | CAPABILITIES.md |
| Caller ABI | ABI.md |
| Provenance | PROVENANCE.md, RECOVERY.json |