omega-mv
Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.
Brought by drakestapleton
omega-mv / tools / omega_ref / README.md
| 1 | # Independent Omega interpreter for compiler qualification |
| 2 | |
| 3 | `omega_ref.c` is an external C test oracle. It interprets Omega values and |
| 4 | statements; it contains no Omega code generator and never invokes `omc`. |
| 5 | It is not part of the seed ladder or a production runtime. The DDC conductor |
| 6 | at `seed/qualification/ddc650/ddc.om` builds it with the host C compiler and |
| 7 | uses it to execute the current compiler source on that same source. |
| 8 | |
| 9 | The starting interpreter is the unchanged file from |
| 10 | `190130b71d0a59b93f01c515218a5509b149a145`. The later abandoned candidate |
| 11 | `abdcd9c48509e81f7e3b7434863b60b262226ae9` contains the same C bytes. |
| 12 | Its shell drivers and historical result tables are intentionally not imported. |
| 13 | The original author derived it from the language specification. This update |
| 14 | also reads the current compiler to identify the language forms it uses; |
| 15 | no emitted instruction or compiler algorithm is copied into the interpreter. |
| 16 | |
| 17 | This restoration replaces fixed source, function, scope-name and block storage |
| 18 | with checked growth. Function call edges use sparse lists. Native allocation |
| 19 | failure is an oracle failure, not evidence about a language refusal. Current |
| 20 | compiler semantics added here are run-time global pools (`*`, `enlarge`, |
| 21 | dynamic `len`, checked `get`/`put`/I/O), environment enumeration and reading, |
| 22 | long names, and explicit while bounds up to `INT64_MAX`. |
| 23 | |
| 24 | The remaining constants describe the original language subset's fixed array, |
| 25 | parameter ABI, default loop and stack rules. They are not claimed to describe |
| 26 | all current Omega features. In particular this is **not** a general OM-2, |
| 27 | float, struct, FFI, device or network interpreter. Unsupported forms fail |
| 28 | explicitly. DDC establishes correspondence for the supplied compiler source, |
| 29 | not semantic completeness of the oracle or correctness of the compiler. |
| 30 | |
| 31 | ## Build and exercise |
| 32 | |
| 33 | Run from the repository root on Linux AArch64, on an assigned CPU if shared: |
| 34 | |
| 35 | ```sh |
| 36 | T=$(mktemp -d) |
| 37 | gcc -O2 -std=gnu11 -Wall -Wextra -Werror tools/omega_ref/omega_ref.c -o "$T/ref" -lpthread |
| 38 | "$T/ref" run seed/omc/omc.om < seed/omc/omc.om > "$T/ref-result" |
| 39 | cmp "$T/ref-result" seed/out/omc |
| 40 | ``` |
| 41 | |
| 42 | `check SOURCE` parses without executing, `run SOURCE` interprets its `main`, |
| 43 | and `call SOURCE ENTRY INPUTS` runs the original scalar function-mode harness. |
| 44 | A parse refusal in run mode exits 125. Executed Omega `trap N` exits 100+N. |
| 45 | Oracle infrastructure errors exit 2. Host C, libc, pthreads, kernel and CPU |
| 46 | remain trusted dependencies. Deep interpreter recursion uses a pthread stack; |
| 47 | it is not a proof of native compiler stack-use equivalence. |
| 48 | |
| 49 | The language regressions in `fixtures/` are compared against the seeded binary: |
| 50 | |
| 51 | | Fixture | Compile/check | Execute both routes | |
| 52 | | --- | --- | --- | |
| 53 | | `pools` | 0 | 0 | |
| 54 | | `pool-refusal` | 0 | 0 under an 8 GiB address-space limit | |
| 55 | | `environment` | 0 | 0 under `env -i TOKEN=value` | |
| 56 | | `environment-index` | 0 | 103 under `env -i TOKEN=value` | |
| 57 | | `pool-bounds`, `pool-max-index` | 0 | 103 | |
| 58 | | `bound` | 0 | 0 | |
| 59 | | `enlarge-expression` | 9 | do not execute | |
| 60 | | `enlarge-fixed` | 7 | do not execute | |
| 61 | |
| 62 | `environment` checks a short destination leaves the old bytes unchanged. |
| 63 | `pools` crosses page boundaries, checks retained/zeroed bytes, no shrinking, |
| 64 | overflow refusal with unchanged state, and a nested call that moves the pool |
| 65 | while a store is being evaluated. `pool-max-index` ensures a literal index on |
| 66 | a run-time pool remains a run-time bounds check. |
| 67 | |
| 68 | `stress.om` generates its own source-size, table-growth and deep-block input; |
| 69 | no giant generated fixture is stored in the repository: |
| 70 | |
| 71 | ```sh |
| 72 | seed/out/omc < tools/omega_ref/stress.om > "$T/generate" |
| 73 | chmod +x "$T/generate" |
| 74 | "$T/generate" > "$T/stress.om" |
| 75 | seed/out/omc < "$T/stress.om" > "$T/native" |
| 76 | chmod +x "$T/native" |
| 77 | "$T/native" |
| 78 | "$T/ref" run "$T/stress.om" |
| 79 | ``` |
| 80 | |
| 81 | Both executions must exit 0. The generated source exceeds the former 8 MiB |
| 82 | source ceiling, 512 functions and 512 nested blocks. |
| 83 | |
| 84 | Passing an extra argument (`"$T/generate" names`) additionally emits more than |
| 85 | 1024 simultaneously visible scalar names. The interpreter must execute that |
| 86 | input successfully; the native compiler currently refuses it with register |
| 87 | error 12. This is an oracle-storage test, not native acceptance equivalence. |
| 88 | The DDC gate and all its corruption controls are documented in its own README. |
| 89 | Run them against the final integrated compiler; an earlier pair's result does |
| 90 | not qualify a changed compiler. |