interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / tools / omega_ref / README.md

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