diff --git a/.crumb b/.crumb index f3e51fe46..4b422c72c 100644 --- a/.crumb +++ b/.crumb @@ -47,8 +47,8 @@ "purpose": "Directory calibration. Purpose not yet described by a human." }, { - "digest": "7ef7796693f23ad68d9a5bcaaee0f635018f4371139a040ba202d4ce7083ede8", - "last_commit": "dd39bf71f", + "digest": "c3dfcf5cc16c31e75d5d1a4a00a278eb4342c75d29e897748bae9787ca625045", + "last_commit": "18efa223c", "name": "docs", "purpose": "Directory docs. Purpose not yet described by a human." }, @@ -72,38 +72,38 @@ }, { "digest": "f765ad87fdddd9b47f690b07298c951a0f7e7675dc5de4ffe44e33a0c14b1986", - "last_commit": "a8a6a3d3c", + "last_commit": "62d1d0d66", "name": "spec", "purpose": "Directory spec. Purpose not yet described by a human." }, { "digest": "aaf5acb82fd4c720cd60c85fd6087f636c72a98e2f3740c9295dcfa525dc64d7", - "last_commit": "bf54b19fa", + "last_commit": "089e5b053", "name": "src", "purpose": "Directory src. Purpose not yet described by a human." }, { "digest": "5395ff8ff9afceebe8e453788f80a3064b831513cc4cb92fd55869115e06b874", - "last_commit": "a8a6a3d3c", + "last_commit": "62d1d0d66", "name": "tests", "purpose": "Directory tests. Purpose not yet described by a human." }, { "digest": "308db0e6cf45c0a48f01f5f5f228450f191389de68006915b9ecf9c65b9a2e29", - "last_commit": "a8a6a3d3c", + "last_commit": "62d1d0d66", "name": "tools", "purpose": "Directory tools. Purpose not yet described by a human." } ], - "children_root": "sha256:07bf1706dcffbad66c0353871ff67a6749055da03cee8d8ebdf9a4c91e36bddc", - "compiled_at": "2026-10-30T12:31:50Z", + "children_root": "sha256:a2f026bb6650c16dd03ed7ccd16929434d71b2432e7d74cb5a8fead3a163758f", + "compiled_at": "2026-10-30T14:55:05Z", "compiler": "crumb-compile/1", - "digest": "sha256:904fca8c0e0cf3e3a5e5adb73393e01c7018b920bb542d289904240f70e400d6", + "digest": "sha256:ca76cdd5a0a9b30bb34578a9da951ca2b3fff05cb42d1520b6548ec2470daad5", "evidence_files": 12622, "evidence_root": "sha256:b1a08e2ce56e6feada0d8a31f06fbd7adee57adc1c1ad8dec220293ee5d439f9", - "files": 17849, - "generated_at_commit": "52a82f392fa513ebbc2d9d719a0f14c385289b06", - "source_tree": "sha256:75458da6553a0ee5ea2af95f46afb658e8a3f6e53cca6e3b4b9874035f78c2ed" + "files": 17917, + "generated_at_commit": "18efa223c8cd5945e47b19b7b9a96f5f56a1479a", + "source_tree": "sha256:fc89c6721ab23ec9f3e1670ec55f34cf30cf6f8efae33f5233079b373b3cef69" }, "owner_lane": "", "provenance": { diff --git a/docs/.crumb b/docs/.crumb index 433100df5..08a619e43 100644 --- a/docs/.crumb +++ b/docs/.crumb @@ -124,14 +124,14 @@ } ], "children_root": "sha256:c81d43c0c392dfec2b6ed5b38ba95ea7c592782b283950e32b777e7b9cfd9d61", - "compiled_at": "2026-10-30T02:47:38Z", + "compiled_at": "2026-10-30T14:55:01Z", "compiler": "crumb-compile/1", - "digest": "sha256:7ef7796693f23ad68d9a5bcaaee0f635018f4371139a040ba202d4ce7083ede8", + "digest": "sha256:c3dfcf5cc16c31e75d5d1a4a00a278eb4342c75d29e897748bae9787ca625045", "evidence_files": 34, "evidence_root": "sha256:589d8b3706e6d7a202ab20b278dac5fc5bafc973f1c2a867b2668aa7210b65cc", "files": 138, - "generated_at_commit": "e615e9ff47d03199514580f655d7670e61ab7e2f", - "source_tree": "sha256:ba44cf86b50127e2ec3824c2e913e032178628d69910a85ca9125cc1ed960bb5" + "generated_at_commit": "bc2c1ffcc0ce87206d23b18bbb93005fe630a259", + "source_tree": "sha256:b0e7b4b72a0ee6eeafb0e260abe79d7e21f579b3c3a0dc05835b4307e96fbc53" }, "owner_lane": "", "provenance": { diff --git a/docs/one_layer/OMEGESE.md b/docs/one_layer/OMEGESE.md index 90fa5d0c3..acf90044e 100644 --- a/docs/one_layer/OMEGESE.md +++ b/docs/one_layer/OMEGESE.md @@ -87,7 +87,7 @@ itself be an op, so no brackets are needed: `add mul r r 4` is add(mul(r, r), 4) | `neg` a / `not` a | 1 | negate (signed) / logical not (bool) or bitwise not (number) | un | | `` a | 1 | a typed number (`uint 5`) or a conversion (`ulong x`, `ulong add a b`) | const / cast | | `get` arr i | 2 | load (arr is an array name) | load | -| `new` type len init | 3 | a new own array of len (1..64) elements; only as the whole value of ` =` | alloc | +| `new` type len init | 3 | a new own array of len elements (omc: 1..16777216, at most 4 MiB of local arrays, s.9.4; the C reference path through OSC IR: 1..64, `OSC_MAX_ARRAY_LEN`); only as the whole value of ` =` | alloc | | `own` / `edit` / `view` arr | 1 | move / mutable borrow / shared borrow (arr is an array name) | mov | | `` args | its parameter count | call an earlier function | call | diff --git a/seed/host/check.sh b/seed/host/check.sh index 4b294cb10..e70dbf377 100644 --- a/seed/host/check.sh +++ b/seed/host/check.sh @@ -40,6 +40,34 @@ grep -qx 'VERDICT mutant-requires FAIL run exit=0 expected=109 stdout=match stde grep -qx 'VERDICT mutant-proof FAIL run exit=0 expected=109 stdout=match stderr=match' "$run/mutant.log" grep -qx 'OM2GATE FAIL cases=2 pass=0 fail=2 invalid=0 not_run=0' "$run/mutant.log" echo 'PASS contract-enforcement mutant detected by exact runtime-status mismatch' +# OM-2 hex literals (#745): every place, decimal twins byte-identical, refusals on the decimal codes. +"$B/gate" seed/out/omc "$pin" seed/omc/om2/hex/hex.cases "$run/hex" > "$run/hex.log" || { cat "$run/hex.log"; exit 1; } +grep -qx 'OM2GATE PASS cases=51 pass=51 fail=0 invalid=0 not_run=0' "$run/hex.log" +if "$B/gate" seed/out/omc "$pin" seed/omc/om2/hex/mutants.cases "$run/hexmut" > "$run/hexmut.log"; then + echo 'FAIL hex-literal mutant survived' >&2 + exit 1 +else + status=$? + [ "$status" = 1 ] || { cat "$run/hexmut.log"; exit 1; } +fi +grep -qx 'OM2GATE FAIL cases=8 pass=3 fail=5 invalid=0 not_run=0' "$run/hexmut.log" +[ "$(grep -c '^VERDICT ctl-hex-[a-z]*-pairs-dec-run PASS ' "$run/hexmut.log")" = 3 ] +[ "$(grep -c '^VERDICT hex-[a-z]*-[a-z0-9-]* FAIL ' "$run/hexmut.log")" = 5 ] +echo 'PASS hex literals (51 cases) and 3 tok_hex mutants killed' +# OM-2 expression boundaries (#745, spec section 2): missing/extra operand and grouping, both profiles. +"$B/gate" seed/out/omc "$pin" seed/omc/om2/bnd/bnd.cases "$run/bnd" > "$run/bnd.log" || { cat "$run/bnd.log"; exit 1; } +grep -qx 'OM2GATE PASS cases=47 pass=47 fail=0 invalid=0 not_run=0' "$run/bnd.log" +if "$B/gate" seed/out/omc "$pin" seed/omc/om2/bnd/mutants.cases "$run/bndmut" > "$run/bndmut.log"; then + echo 'FAIL operand-boundary mutant survived' >&2 + exit 1 +else + status=$? + [ "$status" = 1 ] || { cat "$run/bndmut.log"; exit 1; } +fi +grep -qx 'OM2GATE FAIL cases=10 pass=2 fail=8 invalid=0 not_run=0' "$run/bndmut.log" +[ "$(grep -c '^VERDICT ctl-bnd-[a-z]*-g0-run PASS ' "$run/bndmut.log")" = 2 ] +[ "$(grep -c '^VERDICT bnd-[a-z]*-[a-z0-9-]* FAIL ' "$run/bndmut.log")" = 8 ] +echo 'PASS expression boundaries (47 cases) and 2 operand mutants killed' # Same function-mode contract behavior through the unchanged C referee and OscRt. if [ ! -x build/omegese/omegese ] || [ ! -x build/omega_emit/omega_emit ]; then echo 'NOT_RUN contract C parity: build the comparison oracles' >&2 diff --git a/seed/omc/om2/bnd/README.md b/seed/omc/om2/bnd/README.md new file mode 100644 index 000000000..fd4388094 --- /dev/null +++ b/seed/omc/om2/bnd/README.md @@ -0,0 +1,15 @@ +# OM-2 expression boundary gate (#745 checkbox 2) + +`spec/omegese-om2.md` section 2 (lines 59-62) keeps the OM-1 expression boundaries in both profiles. The cases come from the frozen L836 suite at `seed/qualification/om2/sec/s0s2/candidate.cases`: lines 173-257 and its C2 rows for `s2bnd`. They are copied verbatim, and the fixtures and expected outputs stay there. `seed/host/check.sh` requires both summaries exactly: + +- `bnd.cases`: `OM2GATE PASS cases=47 pass=47 fail=0 invalid=0 not_run=0`. It covers: + - missing operand (`short-*`, error 4); + - tokens after the value (`left-*`: errors 5 and 11); + - grouping (`group-*`, `bracket`, `brace`: errors 16 and 3); + - `g0..g4`: grouped spellings that run to 7 and compile to identical bytes, and to the pinned OM-1 bytes (C2). +- `mutants.cases`: `OM2GATE FAIL cases=10 pass=2 fail=8 invalid=0 not_run=0`. Two mutants of `omc.om`: + - `bnd-extra`: `eol` reports 11 instead of 5. + - `bnd-missing`: `rdval` reports 16 instead of 4 for a missing operand. + - Each mutant kills 4 rows, and the `g0` control passes. + +Under the OM-1 compiler from before #750 (`acb3f15c`, sha256 734f0a39...), `bnd.cases` gives `OM2GATE FAIL cases=47 pass=26 fail=21`. All 21 failures are `s2-om2-*` rows: that compiler has no OM-2 profile. The OM-1 rows pass because OM-1 already had these checks, so no historical compiler lacks them. The mutants are the red run for the checks themselves. diff --git a/seed/omc/om2/bnd/bnd.cases b/seed/omc/om2/bnd/bnd.cases new file mode 100644 index 000000000..5ccad9ef2 --- /dev/null +++ b/seed/omc/om2/bnd/bnd.cases @@ -0,0 +1,97 @@ +# SPDX-License-Identifier: Apache-2.0 +# seed/omc/om2/bnd/bnd.cases: standing gate for omegese-om2.md section 2 expression boundaries (#745 +# checkbox 2): missing operand (error 4), extra operand (errors 5, 11), grouping (16, and g0..g4 that +# compile to identical bytes). Rows copied verbatim from the frozen L836 suite +# seed/qualification/om2/sec/s0s2/candidate.cases (lines 173-257 and its C2 rows for s2bnd); fixtures and +# expected codes stay there. Run from the repository root by seed/qualification/om2/gate.om. +# ======== section 2: expression boundaries (lines 59-62), both profiles; OM-1 codes = pinned OM-1 definition +# lines 59-61: tokens left after the statement's expression (typed operand); OM-1 code pinned (C1 line 17) +s2-om1-left-typed emit seed/qualification/om2/sec/s0s2/s2bnd/om1-left-typed.om - err:6:5 5 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-left-typed emit seed/qualification/om2/sec/s0s2/s2bnd/om2-left-typed.om - err:7:5 5 +# lines 59-61: tokens left after an assignment's expression; OM-1 code pinned (C1 line 17) +s2-om1-left-assign emit seed/qualification/om2/sec/s0s2/s2bnd/om1-left-assign.om - err:6:5 5 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-left-assign emit seed/qualification/om2/sec/s0s2/s2bnd/om2-left-assign.om - err:7:5 5 +# lines 59-61: a stray ) after a complete expression; OM-1 code pinned (C1 line 17) +s2-om1-left-paren emit seed/qualification/om2/sec/s0s2/s2bnd/om1-left-paren.om - err:6:5 5 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-left-paren emit seed/qualification/om2/sec/s0s2/s2bnd/om2-left-paren.om - err:7:5 5 +# lines 59-61: tokens left after add of two bare numbers (ambiguity is found first); OM-1 code pinned (C1 line 17) +s2-om1-left-bare emit seed/qualification/om2/sec/s0s2/s2bnd/om1-left-bare.om - err:5:11 11 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-left-bare emit seed/qualification/om2/sec/s0s2/s2bnd/om2-left-bare.om - err:6:11 11 +# lines 59-61: line ends before an operand is complete, followed by end; OM-1 code pinned (C1 line 17) +s2-om1-short-next emit seed/qualification/om2/sec/s0s2/s2bnd/om1-short-next.om - err:7:4 4 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-short-next emit seed/qualification/om2/sec/s0s2/s2bnd/om2-short-next.om - err:8:4 4 +# lines 59-61: ret add 1 then end; OM-1 code pinned (C1 line 17) +s2-om1-short-bare emit seed/qualification/om2/sec/s0s2/s2bnd/om1-short-bare.om - err:6:4 4 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-short-bare emit seed/qualification/om2/sec/s0s2/s2bnd/om2-short-bare.om - err:7:4 4 +# lines 59-61: input ends (no final LF) before an operand is complete; OM-1 code pinned (C1 line 17) +s2-om1-short-eof emit seed/qualification/om2/sec/s0s2/s2bnd/om1-short-eof.om - err:6:4 4 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-short-eof emit seed/qualification/om2/sec/s0s2/s2bnd/om2-short-eof.om - err:7:4 4 +# lines 59-61: a group missing its ) (OMEGESE 9.10); OM-1 code pinned (C1 line 17) +s2-om1-group-open emit seed/qualification/om2/sec/s0s2/s2bnd/om1-group-open.om - err:6:16 16 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-group-open emit seed/qualification/om2/sec/s0s2/s2bnd/om2-group-open.om - err:7:16 16 +# lines 59-61: a group closed before its word has all operands; OM-1 code pinned (C1 line 17) +s2-om1-group-short emit seed/qualification/om2/sec/s0s2/s2bnd/om1-group-short.om - err:6:16 16 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-group-short emit seed/qualification/om2/sec/s0s2/s2bnd/om2-group-short.om - err:7:16 16 +# lines 59-61: a group holding two values for one operand; OM-1 code pinned (C1 line 17) +s2-om1-group-wide emit seed/qualification/om2/sec/s0s2/s2bnd/om1-group-wide.om - err:6:16 16 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-group-wide emit seed/qualification/om2/sec/s0s2/s2bnd/om2-group-wide.om - err:7:16 16 +# lines 59-61: [ is not grouping; OM-1 code pinned (C1 line 17) +s2-om1-bracket emit seed/qualification/om2/sec/s0s2/s2bnd/om1-bracket.om - err:6:3 3 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-bracket emit seed/qualification/om2/sec/s0s2/s2bnd/om2-bracket.om - err:7:3 3 +# lines 59-61: { is not grouping; OM-1 code pinned (C1 line 17) +s2-om1-brace emit seed/qualification/om2/sec/s0s2/s2bnd/om1-brace.om - err:6:3 3 +# line 59 'both profiles, unchanged' (+ line 62 no new grouping for [ and {): same code in an OM-2 unit, line +1 for the om2 line +s2-om2-brace emit seed/qualification/om2/sec/s0s2/s2bnd/om2-brace.om - err:7:3 3 +# lines 61-62: grouping never changes which operands a word takes +s2-om1-g0-run run seed/qualification/om2/sec/s0s2/s2bnd/om1-g0.om - - - 7 +# lines 61-62: grouping never changes which operands a word takes +s2-om1-g1-run run seed/qualification/om2/sec/s0s2/s2bnd/om1-g1.om - - - 7 +# line 61: a group adds no code +s2-om1-g1-same same seed/qualification/om2/sec/s0s2/s2bnd/om1-g0.om seed/qualification/om2/sec/s0s2/s2bnd/om1-g1.om +# lines 61-62: grouping never changes which operands a word takes +s2-om1-g2-run run seed/qualification/om2/sec/s0s2/s2bnd/om1-g2.om - - - 7 +# line 61: a group adds no code +s2-om1-g2-same same seed/qualification/om2/sec/s0s2/s2bnd/om1-g0.om seed/qualification/om2/sec/s0s2/s2bnd/om1-g2.om +# lines 61-62: grouping never changes which operands a word takes +s2-om1-g3-run run seed/qualification/om2/sec/s0s2/s2bnd/om1-g3.om - - - 7 +# line 61: a group adds no code +s2-om1-g3-same same seed/qualification/om2/sec/s0s2/s2bnd/om1-g0.om seed/qualification/om2/sec/s0s2/s2bnd/om1-g3.om +# lines 61-62: grouping never changes which operands a word takes +s2-om1-g4-run run seed/qualification/om2/sec/s0s2/s2bnd/om1-g4.om - - - 7 +# line 61: a group adds no code +s2-om1-g4-same same seed/qualification/om2/sec/s0s2/s2bnd/om1-g0.om seed/qualification/om2/sec/s0s2/s2bnd/om1-g4.om +# lines 61-62: grouping never changes which operands a word takes +s2-om2-g0-run run seed/qualification/om2/sec/s0s2/s2bnd/om2-g0.om - - - 7 +# lines 61-62: grouping never changes which operands a word takes +s2-om2-g1-run run seed/qualification/om2/sec/s0s2/s2bnd/om2-g1.om - - - 7 +# line 61: a group adds no code +s2-om2-g1-same same seed/qualification/om2/sec/s0s2/s2bnd/om2-g0.om seed/qualification/om2/sec/s0s2/s2bnd/om2-g1.om +# lines 61-62: grouping never changes which operands a word takes +s2-om2-g2-run run seed/qualification/om2/sec/s0s2/s2bnd/om2-g2.om - - - 7 +# line 61: a group adds no code +s2-om2-g2-same same seed/qualification/om2/sec/s0s2/s2bnd/om2-g0.om seed/qualification/om2/sec/s0s2/s2bnd/om2-g2.om +# lines 61-62: grouping never changes which operands a word takes +s2-om2-g3-run run seed/qualification/om2/sec/s0s2/s2bnd/om2-g3.om - - - 7 +# line 61: a group adds no code +s2-om2-g3-same same seed/qualification/om2/sec/s0s2/s2bnd/om2-g0.om seed/qualification/om2/sec/s0s2/s2bnd/om2-g3.om +# lines 61-62: grouping never changes which operands a word takes +s2-om2-g4-run run seed/qualification/om2/sec/s0s2/s2bnd/om2-g4.om - - - 7 +# line 61: a group adds no code +s2-om2-g4-same same seed/qualification/om2/sec/s0s2/s2bnd/om2-g0.om seed/qualification/om2/sec/s0s2/s2bnd/om2-g4.om +# C2: OM-1 grouping units compile to the pinned OM-1 (734f0a39) bytes +c2-s2-om1-g0 emit seed/qualification/om2/sec/s0s2/s2bnd/om1-g0.om sha:fd03a4208a3ada5e357c3901042dd1abc2e8f12196725fb3af43b1cd3f2254ce - 0 +c2-s2-om1-g1 emit seed/qualification/om2/sec/s0s2/s2bnd/om1-g1.om sha:fd03a4208a3ada5e357c3901042dd1abc2e8f12196725fb3af43b1cd3f2254ce - 0 +c2-s2-om1-g2 emit seed/qualification/om2/sec/s0s2/s2bnd/om1-g2.om sha:fd03a4208a3ada5e357c3901042dd1abc2e8f12196725fb3af43b1cd3f2254ce - 0 +c2-s2-om1-g3 emit seed/qualification/om2/sec/s0s2/s2bnd/om1-g3.om sha:fd03a4208a3ada5e357c3901042dd1abc2e8f12196725fb3af43b1cd3f2254ce - 0 +c2-s2-om1-g4 emit seed/qualification/om2/sec/s0s2/s2bnd/om1-g4.om sha:fd03a4208a3ada5e357c3901042dd1abc2e8f12196725fb3af43b1cd3f2254ce - 0 diff --git a/seed/omc/om2/bnd/mutants.cases b/seed/omc/om2/bnd/mutants.cases new file mode 100644 index 000000000..03fd34f31 --- /dev/null +++ b/seed/omc/om2/bnd/mutants.cases @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: Apache-2.0 +# seed/omc/om2/bnd/mutants.cases: two omc.om mutants of the operand-boundary checks; each kill row is a +# correct-side row of bnd.cases and must FAIL; the g0 control must PASS. Expected: pass=2 fail=8. +# --- mutant bnd-extra +subst seed/omc/om2/bnd/mutants/bnd-extra.from seed/omc/om2/bnd/mutants/bnd-extra.to +cc seed/omc/omc.om +ctl-bnd-extra-g0-run run seed/qualification/om2/sec/s0s2/s2bnd/om2-g0.om - - - 7 +bnd-extra-om1-left-typed emit seed/qualification/om2/sec/s0s2/s2bnd/om1-left-typed.om - err:6:5 5 +bnd-extra-om2-left-typed emit seed/qualification/om2/sec/s0s2/s2bnd/om2-left-typed.om - err:7:5 5 +bnd-extra-om1-left-assign emit seed/qualification/om2/sec/s0s2/s2bnd/om1-left-assign.om - err:6:5 5 +bnd-extra-om2-left-assign emit seed/qualification/om2/sec/s0s2/s2bnd/om2-left-assign.om - err:7:5 5 +cc pinned +# --- mutant bnd-missing +subst seed/omc/om2/bnd/mutants/bnd-missing.from seed/omc/om2/bnd/mutants/bnd-missing.to +cc seed/omc/omc.om +ctl-bnd-missing-g0-run run seed/qualification/om2/sec/s0s2/s2bnd/om2-g0.om - - - 7 +bnd-missing-om1-short-next emit seed/qualification/om2/sec/s0s2/s2bnd/om1-short-next.om - err:7:4 4 +bnd-missing-om2-short-next emit seed/qualification/om2/sec/s0s2/s2bnd/om2-short-next.om - err:8:4 4 +bnd-missing-om1-short-bare emit seed/qualification/om2/sec/s0s2/s2bnd/om1-short-bare.om - err:6:4 4 +bnd-missing-om2-short-bare emit seed/qualification/om2/sec/s0s2/s2bnd/om2-short-bare.om - err:7:4 4 +cc pinned diff --git a/seed/omc/om2/bnd/mutants/bnd-extra.from b/seed/omc/om2/bnd/mutants/bnd-extra.from new file mode 100644 index 000000000..014f0be16 --- /dev/null +++ b/seed/omc/om2/bnd/mutants/bnd-extra.from @@ -0,0 +1,5 @@ +put dexp 0 6 +tok +k = get tk 0 +if and ne k 0 ne k 3 +fail 5 diff --git a/seed/omc/om2/bnd/mutants/bnd-extra.to b/seed/omc/om2/bnd/mutants/bnd-extra.to new file mode 100644 index 000000000..b31efb294 --- /dev/null +++ b/seed/omc/om2/bnd/mutants/bnd-extra.to @@ -0,0 +1,5 @@ +put dexp 0 6 +tok +k = get tk 0 +if and ne k 0 ne k 3 +fail 11 diff --git a/seed/omc/om2/bnd/mutants/bnd-missing.from b/seed/omc/om2/bnd/mutants/bnd-missing.from new file mode 100644 index 000000000..7ff186e2a --- /dev/null +++ b/seed/omc/om2/bnd/mutants/bnd-missing.from @@ -0,0 +1,5 @@ +if gt get depth 0 1024 +fail 14 +end +if or eq get tk 0 0 eq get tk 0 3 +fail 4 diff --git a/seed/omc/om2/bnd/mutants/bnd-missing.to b/seed/omc/om2/bnd/mutants/bnd-missing.to new file mode 100644 index 000000000..375f4f0f6 --- /dev/null +++ b/seed/omc/om2/bnd/mutants/bnd-missing.to @@ -0,0 +1,5 @@ +if gt get depth 0 1024 +fail 14 +end +if or eq get tk 0 0 eq get tk 0 3 +fail 16 diff --git a/seed/omc/om2/hex/README.md b/seed/omc/om2/hex/README.md new file mode 100644 index 000000000..98c6d28a5 --- /dev/null +++ b/seed/omc/om2/hex/README.md @@ -0,0 +1,31 @@ +# OM-2 hex literal fixtures (#745) + +Coverage for `spec/omegese-om2.md` section 2 (hex literal, lines 53-58), implemented in +`seed/omc/omc.om` `tok_hex` by #750. Run by `seed/qualification/om2/gate.om`; `seed/host/check.sh` +requires both summaries below exactly. + +- `hex.cases` (51 cases): `OM2GATE PASS cases=51 pass=51 fail=0 invalid=0 not_run=0`. + - values: `pairs-*` (64 literals, eight per integer type: 0, 1, maximum, sign-bit or half value, + four random), `floatlike-*` (`e`/`f` digits that the decimal path reads as float markers), + `places-*` (const, global length, view/edit lengths, new, put, unroll, while bound, rotr/rotl, + f64/f32 conversion, trap code), `fnmode-*` (function mode), the x86linux target (`target.txt+`); + each runs to the Wolfram value and its decimal twin compiles to the same bytes (`same`). + - refusals `ref/`: every out-of-range hex literal gets its decimal twin's code on the same line + (8; 23 for a global past 16777216, as decimal); `-` before hex, 17 digits, `00x1`, `-0X1`, `0x1.8`, + `0x-1` are error 6. + - versioning `om1/`: an OM-1 unit, including IR mode, has no hex literal (error 6). +- `mutants.cases`: three `tok_hex` mutants of `omc.om` (`mutants/*.from` -> `*.to`), each killed; + the decimal control passes under each: `OM2GATE FAIL cases=8 pass=3 fail=5 invalid=0 not_run=0`. + - `hex-tbig`: no big flag (ulong >= 2^63 refused, signedness check lost); + - `hex-nolimit`: the 16-digit limit dropped (17 digits silently truncate to 64 bits); + - `hex-digit`: wrong value for a-f. +- `wolfram.txt`: the queries that produced every spelling and expected value. + +Run from the repository root: + + seed/out/omc < seed/qualification/om2/gate.om > /tmp/gate && chmod +x /tmp/gate + /tmp/gate seed/out/omc "$(sha256sum seed/out/omc | cut -d' ' -f1)" seed/omc/om2/hex/hex.cases /tmp/hexrun + +Under the OM-1 compiler before #750 (`git show acb3f15c:seed/out/omc`, sha256 734f0a39...) the same +file gives `OM2GATE FAIL cases=51 pass=4 fail=47`: the 4 passes are the three OM-1 refusals and +`r8-const-dec` (that compiler refuses the const line before it reaches the `om2` line). diff --git a/seed/omc/om2/hex/exp/floatlike.out b/seed/omc/om2/hex/exp/floatlike.out new file mode 100644 index 000000000..f65ca7f7d --- /dev/null +++ b/seed/omc/om2/hex/exp/floatlike.out @@ -0,0 +1,10 @@ +14 +15 +30 +485 +7986 +8036 +3599 +24080 +3890 +254 diff --git a/seed/omc/om2/hex/exp/pairs.out b/seed/omc/om2/hex/exp/pairs.out new file mode 100644 index 000000000..a18fd1cda --- /dev/null +++ b/seed/omc/om2/hex/exp/pairs.out @@ -0,0 +1,64 @@ +0 +1 +255 +128 +170 +153 +75 +36 +0 +1 +65535 +32768 +21603 +33716 +7831 +38284 +0 +1 +4294967295 +2147483648 +83920300 +1509667242 +3150959341 +3910442725 +0 +1 +18446744073709551615 +9223372036854775808 +15205998013390911501 +16740117136465882709 +1684610389927020364 +6097465819152223959 +0 +1 +127 +64 +55 +1 +35 +36 +0 +1 +32767 +16384 +29462 +18848 +28453 +23010 +0 +1 +2147483647 +1073741824 +491140535 +3657980 +499641010 +2038208288 +0 +1 +9223372036854775807 +4611686018427387904 +2358124982775785610 +5281094983814553355 +6496971512538355926 +4123693503557151770 diff --git a/seed/omc/om2/hex/exp/places.out b/seed/omc/om2/hex/exp/places.out new file mode 100644 index 000000000..2406c7328 --- /dev/null +++ b/seed/omc/om2/hex/exp/places.out @@ -0,0 +1,9 @@ +90 +7 +200 +6 +100 +3 +1 +9007199254740992 +16777216 diff --git a/seed/omc/om2/hex/floatlike-dec.om b/seed/omc/om2/hex/floatlike-dec.om new file mode 100644 index 000000000..ac3a389e0 --- /dev/null +++ b/seed/omc/om2/hex/floatlike-dec.om @@ -0,0 +1,26 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of floatlike-hex.om (values from Wolfram, wolfram.txt query tokens). +om2 +fn main to int +a = ulong 14 +putu a +a = ulong 15 +putu a +a = ulong 30 +putu a +a = ulong 485 +putu a +a = ulong 7986 +putu a +a = ulong 8036 +putu a +a = ulong 3599 +putu a +a = ulong 24080 +putu a +a = ulong 3890 +putu a +a = ulong 254 +putu a +ret 0 +end diff --git a/seed/omc/om2/hex/floatlike-hex.om b/seed/omc/om2/hex/floatlike-hex.om new file mode 100644 index 000000000..bf965954b --- /dev/null +++ b/seed/omc/om2/hex/floatlike-hex.om @@ -0,0 +1,27 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): hex digits e and f are digits, never the float exponent +note or suffix markers of the decimal path: 0x1e is 30, 0x1f32 is 7986. Values from Wolfram (wolfram.txt). +om2 +fn main to int +a = ulong 0xe +putu a +a = ulong 0xf +putu a +a = ulong 0x1e +putu a +a = ulong 0x1e5 +putu a +a = ulong 0x1f32 +putu a +a = ulong 0x1f64 +putu a +a = ulong 0xe0f +putu a +a = ulong 0x5e10 +putu a +a = ulong 0xf32 +putu a +a = ulong 0xfe +putu a +ret 0 +end diff --git a/seed/omc/om2/hex/fnmode-dec.om b/seed/omc/om2/hex/fnmode-dec.om new file mode 100644 index 000000000..9bb55af8b --- /dev/null +++ b/seed/omc/om2/hex/fnmode-dec.om @@ -0,0 +1,16 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of fnmode-hex.om (values from Wolfram, wolfram.txt queries tokens and tokens2). +om2 +const KM ulong 255 +fn f a ulong to ulong +b = new uchar 16 0 +put b 15 uchar and a KM +k = ulong 0 +while lt k 3 bound 10 +k = add k 1 +end +if eq k 0 +trap 13 +end +ret add ulong get b 15 k +end diff --git a/seed/omc/om2/hex/fnmode-hex.om b/seed/omc/om2/hex/fnmode-hex.om new file mode 100644 index 000000000..fb3848f75 --- /dev/null +++ b/seed/omc/om2/hex/fnmode-hex.om @@ -0,0 +1,17 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): function mode (no fn main) with hex in a const, new length +note and fill, index, while bound and trap code; fnmode-dec.om is the decimal spelling: same bytes. +om2 +const KM ulong 0xff +fn f a ulong to ulong +b = new uchar 0x10 0x0 +put b 0xf uchar and a KM +k = ulong 0x0 +while lt k 0x3 bound 0xa +k = add k 0x1 +end +if eq k 0x0 +trap 0xd +end +ret add ulong get b 0xf k +end diff --git a/seed/omc/om2/hex/hex.cases b/seed/omc/om2/hex/hex.cases new file mode 100644 index 000000000..cc1c68bff --- /dev/null +++ b/seed/omc/om2/hex/hex.cases @@ -0,0 +1,110 @@ +# SPDX-License-Identifier: Apache-2.0 +# seed/omc/om2/hex/hex.cases: OM-2 hex literal coverage for #745 (spec/omegese-om2.md section 2, +# lines 53-58), run by seed/qualification/om2/gate.om. Every expected value comes from Wolfram +# (wolfram.txt); every expected error is the spec code (6 malformed, 8 range, 23 arrlen as decimal) +# on the literal's line. seed/host/check.sh requires OM2GATE PASS. +# ---- values: 64 literals over the eight integer types, decimal twin byte-identical +# pairs: hex spelling prints the Wolfram decimals, exit 0 +hex-pairs-run run seed/omc/om2/hex/pairs-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/pairs.out - 0 +# pairs: decimal spelling prints the same +hex-pairs-dec-run run seed/omc/om2/hex/pairs-dec.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/pairs.out - 0 +# pairs: line 58 "0x2a and 42 compile identically", for every literal in the file +hex-pairs-same same seed/omc/om2/hex/pairs-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om seed/omc/om2/hex/pairs-dec.om+seed/qualification/om2/sec/s0s2/lib/putu.om +# floatlike: hex spelling prints the Wolfram decimals, exit 0 +hex-floatlike-run run seed/omc/om2/hex/floatlike-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/floatlike.out - 0 +# floatlike: decimal spelling prints the same +hex-floatlike-dec-run run seed/omc/om2/hex/floatlike-dec.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/floatlike.out - 0 +# floatlike: line 58 "0x2a and 42 compile identically", for every literal in the file +hex-floatlike-same same seed/omc/om2/hex/floatlike-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om seed/omc/om2/hex/floatlike-dec.om+seed/qualification/om2/sec/s0s2/lib/putu.om +# places: hex spelling prints the Wolfram decimals, exit 32 +hex-places-run run seed/omc/om2/hex/places-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/places.out - 32 +# places: decimal spelling prints the same +hex-places-dec-run run seed/omc/om2/hex/places-dec.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/places.out - 32 +# places: line 58 "0x2a and 42 compile identically", for every literal in the file +hex-places-same same seed/omc/om2/hex/places-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om seed/omc/om2/hex/places-dec.om+seed/qualification/om2/sec/s0s2/lib/putu.om +# function mode: hex in const, new, put, while bound, trap code; byte-identical to decimal +hex-fnmode-same same seed/omc/om2/hex/fnmode-hex.om seed/omc/om2/hex/fnmode-dec.om +# x86linux target: the same 64 literals, byte-identical to decimal +hex-x86-pairs-same same seed/omc/om2/hex/target.txt+seed/omc/om2/hex/pairs-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om seed/omc/om2/hex/target.txt+seed/omc/om2/hex/pairs-dec.om+seed/qualification/om2/sec/s0s2/lib/putu.om +# x86linux target: every place, byte-identical to decimal +hex-x86-places-same same seed/omc/om2/hex/target.txt+seed/omc/om2/hex/places-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om seed/omc/om2/hex/target.txt+seed/omc/om2/hex/places-dec.om+seed/qualification/om2/sec/s0s2/lib/putu.om +# signed minima in decimal against hex operands, exit 0 +hex-signed-min run seed/omc/om2/hex/signed-min.om - - - 0 +# ---- refusals: the hex literal gets the decimal twin's code on the same line (decimal range rule) +# const value 0x100 outside uchar +hex-r8-const emit seed/omc/om2/hex/ref/r8-const.om - err:4:8 8 +# decimal twin of r8-const +hex-r8-const-dec emit seed/omc/om2/hex/ref/r8-const-dec.om - err:4:8 8 +# global length 0x0 (1..16777216) +hex-r8-global0 emit seed/omc/om2/hex/ref/r8-global0.om - err:4:8 8 +# decimal twin of r8-global0 +hex-r8-global0-dec emit seed/omc/om2/hex/ref/r8-global0-dec.om - err:4:8 8 +# while bound 0xf4240 = 1000000 past 999999 +hex-r8-bound emit seed/omc/om2/hex/ref/r8-bound.om - err:6:8 8 +# decimal twin of r8-bound +hex-r8-bound-dec emit seed/omc/om2/hex/ref/r8-bound-dec.om - err:6:8 8 +# unroll count 0x41 = 65 past 64 +hex-r8-unroll emit seed/omc/om2/hex/ref/r8-unroll.om - err:5:8 8 +# decimal twin of r8-unroll +hex-r8-unroll-dec emit seed/omc/om2/hex/ref/r8-unroll-dec.om - err:5:8 8 +# unroll count 0x0 +hex-r8-unroll0 emit seed/omc/om2/hex/ref/r8-unroll0.om - err:5:8 8 +# decimal twin of r8-unroll0 +hex-r8-unroll0-dec emit seed/omc/om2/hex/ref/r8-unroll0-dec.om - err:5:8 8 +# trap code 0xf = 15 past 14 +hex-r8-trap emit seed/omc/om2/hex/ref/r8-trap.om - err:7:8 8 +# decimal twin of r8-trap +hex-r8-trap-dec emit seed/omc/om2/hex/ref/r8-trap-dec.om - err:7:8 8 +# trap code 0x0 +hex-r8-trap0 emit seed/omc/om2/hex/ref/r8-trap0.om - err:7:8 8 +# decimal twin of r8-trap0 +hex-r8-trap0-dec emit seed/omc/om2/hex/ref/r8-trap0-dec.om - err:7:8 8 +# put value 0x100 into a uchar array (no truncation) +hex-r8-put emit seed/omc/om2/hex/ref/r8-put.om - err:6:8 8 +# decimal twin of r8-put +hex-r8-put-dec emit seed/omc/om2/hex/ref/r8-put-dec.om - err:6:8 8 +# new fill 0x100 for uchar (no truncation) +hex-r8-fill emit seed/omc/om2/hex/ref/r8-fill.om - err:5:8 8 +# decimal twin of r8-fill +hex-r8-fill-dec emit seed/omc/om2/hex/ref/r8-fill-dec.om - err:5:8 8 +# call argument 0x100 for a uchar parameter (no truncation) +hex-r8-arg emit seed/omc/om2/hex/ref/r8-arg.om - err:8:8 8 +# decimal twin of r8-arg +hex-r8-arg-dec emit seed/omc/om2/hex/ref/r8-arg-dec.om - err:8:8 8 +# comparison operand 0x100 against uchar (no truncation) +hex-r8-cmp emit seed/omc/om2/hex/ref/r8-cmp.om - err:6:8 8 +# decimal twin of r8-cmp +hex-r8-cmp-dec emit seed/omc/om2/hex/ref/r8-cmp-dec.om - err:6:8 8 +# sub operand 0x80 for byte (no two s-complement reinterpretation) +hex-r8-sub emit seed/omc/om2/hex/ref/r8-sub.om - err:6:8 8 +# decimal twin of r8-sub +hex-r8-sub-dec emit seed/omc/om2/hex/ref/r8-sub-dec.om - err:6:8 8 +# 0x0100: leading zeros do not change the value 256, out of uchar +hex-r8-lead0 emit seed/omc/om2/hex/ref/r8-lead0.om - err:5:8 8 +# decimal twin of r8-lead0 +hex-r8-lead0-dec emit seed/omc/om2/hex/ref/r8-lead0-dec.om - err:5:8 8 +# a - before a hex literal: signed minima have no hex spelling +hex-r6-negbyte emit seed/omc/om2/hex/ref/r6-negbyte.om - err:5:6 6 +# a - before a hex literal (long minimum) +hex-r6-neglong emit seed/omc/om2/hex/ref/r6-neglong.om - err:5:6 6 +# 17 digits, error 6 before any truncation to 64 bits +hex-r6-17trunc emit seed/omc/om2/hex/ref/r6-17trunc.om - err:5:6 6 +# 00x1 is not a hex literal +hex-r6-lead00x emit seed/omc/om2/hex/ref/r6-lead00x.om - err:5:6 6 +# -0X1: minus and uppercase X +hex-r6-negX emit seed/omc/om2/hex/ref/r6-negX.om - err:5:6 6 +# 0x1.8: no hex fraction +hex-r6-dot emit seed/omc/om2/hex/ref/r6-dot.om - err:5:6 6 +# 0x-1: digit outside 0-9a-f +hex-r6-xneg emit seed/omc/om2/hex/ref/r6-xneg.om - err:5:6 6 +# global length 0x1000001 past 16777216 (arrlen, error 23 as decimal) +hex-r23-globalbig emit seed/omc/om2/hex/ref/r23-globalbig.om - err:4:23 23 +# decimal twin of r23-globalbig +hex-r23-globalbig-dec emit seed/omc/om2/hex/ref/r23-globalbig-dec.om - err:4:23 23 +# ---- versioning: no hex literal outside an OM-2 unit (OMEGESE 9.13) +# an OM-1 unit (no om2 line) has no hex literal: const value +hex-om1-const emit seed/omc/om2/hex/om1/om1-const.om - err:3:6 6 +# an OM-1 unit has no hex literal, including 0x1e that the decimal path reads as a float +hex-om1-floatlike emit seed/omc/om2/hex/om1/om1-floatlike.om - err:4:6 6 +# IR mode is OM-1 only: no hex literal +hex-om1-ir emit seed/omc/om2/hex/om1/om1-ir.om - err:5:6 6 diff --git a/seed/omc/om2/hex/mutants.cases b/seed/omc/om2/hex/mutants.cases new file mode 100644 index 000000000..709b34013 --- /dev/null +++ b/seed/omc/om2/hex/mutants.cases @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: Apache-2.0 +# seed/omc/om2/hex/mutants.cases: tok_hex mutants of seed/omc/omc.om (#745). Each row is a CORRECT-side +# row of hex.cases rerun under the mutant compiler: a mutant is killed when every listed row FAILs. +# The ctl row (the decimal twin, no hex literal) must PASS under each mutant. Expected summary: pass=3 fail=5. +# --- mutant hex-tbig +subst seed/omc/om2/hex/mutants/hex-tbig.from seed/omc/om2/hex/mutants/hex-tbig.to +cc seed/omc/omc.om +ctl-hex-tbig-pairs-dec-run run seed/omc/om2/hex/pairs-dec.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/pairs.out - 0 +hex-tbig-pairs-run run seed/omc/om2/hex/pairs-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/pairs.out - 0 +hex-tbig-places-run run seed/omc/om2/hex/places-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/places.out - 32 +cc pinned +# --- mutant hex-nolimit +subst seed/omc/om2/hex/mutants/hex-nolimit.from seed/omc/om2/hex/mutants/hex-nolimit.to +cc seed/omc/omc.om +ctl-hex-nolimit-pairs-dec-run run seed/omc/om2/hex/pairs-dec.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/pairs.out - 0 +hex-nolimit-r6-17trunc emit seed/omc/om2/hex/ref/r6-17trunc.om - err:5:6 6 +cc pinned +# --- mutant hex-digit +subst seed/omc/om2/hex/mutants/hex-digit.from seed/omc/om2/hex/mutants/hex-digit.to +cc seed/omc/omc.om +ctl-hex-digit-pairs-dec-run run seed/omc/om2/hex/pairs-dec.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/pairs.out - 0 +hex-digit-pairs-run run seed/omc/om2/hex/pairs-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/pairs.out - 0 +hex-digit-floatlike-run run seed/omc/om2/hex/floatlike-hex.om+seed/qualification/om2/sec/s0s2/lib/putu.om - file:seed/omc/om2/hex/exp/floatlike.out - 0 +cc pinned diff --git a/seed/omc/om2/hex/mutants/hex-digit.from b/seed/omc/om2/hex/mutants/hex-digit.from new file mode 100644 index 000000000..e123887af --- /dev/null +++ b/seed/omc/om2/hex/mutants/hex-digit.from @@ -0,0 +1 @@ +sub d 87 \ No newline at end of file diff --git a/seed/omc/om2/hex/mutants/hex-digit.to b/seed/omc/om2/hex/mutants/hex-digit.to new file mode 100644 index 000000000..5c34ab983 --- /dev/null +++ b/seed/omc/om2/hex/mutants/hex-digit.to @@ -0,0 +1 @@ +sub d 86 \ No newline at end of file diff --git a/seed/omc/om2/hex/mutants/hex-nolimit.from b/seed/omc/om2/hex/mutants/hex-nolimit.from new file mode 100644 index 000000000..5d1054c3b --- /dev/null +++ b/seed/omc/om2/hex/mutants/hex-nolimit.from @@ -0,0 +1,2 @@ +if gt n 16 +nfail 6 diff --git a/seed/omc/om2/hex/mutants/hex-nolimit.to b/seed/omc/om2/hex/mutants/hex-nolimit.to new file mode 100644 index 000000000..5df6f5a86 --- /dev/null +++ b/seed/omc/om2/hex/mutants/hex-nolimit.to @@ -0,0 +1,2 @@ +if gt n 99 +nfail 6 diff --git a/seed/omc/om2/hex/mutants/hex-tbig.from b/seed/omc/om2/hex/mutants/hex-tbig.from new file mode 100644 index 000000000..3c4e3f9db --- /dev/null +++ b/seed/omc/om2/hex/mutants/hex-tbig.from @@ -0,0 +1 @@ +put tbig 0 shr v 63 diff --git a/seed/omc/om2/hex/mutants/hex-tbig.to b/seed/omc/om2/hex/mutants/hex-tbig.to new file mode 100644 index 000000000..e291cf5e0 --- /dev/null +++ b/seed/omc/om2/hex/mutants/hex-tbig.to @@ -0,0 +1 @@ +put tbig 0 0 diff --git a/seed/omc/om2/hex/om1/om1-const.om b/seed/omc/om2/hex/om1/om1-const.om new file mode 100644 index 000000000..9ce113919 --- /dev/null +++ b/seed/omc/om2/hex/om1/om1-const.om @@ -0,0 +1,6 @@ +note SPDX-License-Identifier: Apache-2.0 +note OMEGESE 9.13 / spec/omegese-om2.md section 2 lines 53-58 (#745): an OM-1 unit (no om2 line) has no hex literal: const value; error 6 on the literal's line. +const KC ulong 0x10 +fn main to int +ret 0 +end diff --git a/seed/omc/om2/hex/om1/om1-floatlike.om b/seed/omc/om2/hex/om1/om1-floatlike.om new file mode 100644 index 000000000..a93a591b3 --- /dev/null +++ b/seed/omc/om2/hex/om1/om1-floatlike.om @@ -0,0 +1,6 @@ +note SPDX-License-Identifier: Apache-2.0 +note OMEGESE 9.13 / spec/omegese-om2.md section 2 lines 53-58 (#745): an OM-1 unit has no hex literal, including 0x1e that the decimal path reads as a float; error 6 on the literal's line. +fn main to int +x = ulong 0x1e +ret 0 +end diff --git a/seed/omc/om2/hex/om1/om1-ir.om b/seed/omc/om2/hex/om1/om1-ir.om new file mode 100644 index 000000000..f01d8a8eb --- /dev/null +++ b/seed/omc/om2/hex/om1/om1-ir.om @@ -0,0 +1,7 @@ +ir +note SPDX-License-Identifier: Apache-2.0 +note OMEGESE 9.13 / spec/omegese-om2.md section 2 lines 53-58 (#745): IR mode is OM-1 only: no hex literal; error 6 on the literal's line. +fn main to int +x = ulong 0x10 +ret 0 +end diff --git a/seed/omc/om2/hex/pairs-dec.om b/seed/omc/om2/hex/pairs-dec.om new file mode 100644 index 000000000..3d11195ee --- /dev/null +++ b/seed/omc/om2/hex/pairs-dec.om @@ -0,0 +1,135 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of pairs-hex.om (spellings from Wolfram, wolfram.txt query pairs). +note Compiles byte-identically to pairs-hex.om. +om2 +fn main to int +a = uchar 0 +putu ulong a +a = uchar 1 +putu ulong a +a = uchar 255 +putu ulong a +a = uchar 128 +putu ulong a +a = uchar 170 +putu ulong a +a = uchar 153 +putu ulong a +a = uchar 75 +putu ulong a +a = uchar 36 +putu ulong a +b = ushort 0 +putu ulong b +b = ushort 1 +putu ulong b +b = ushort 65535 +putu ulong b +b = ushort 32768 +putu ulong b +b = ushort 21603 +putu ulong b +b = ushort 33716 +putu ulong b +b = ushort 7831 +putu ulong b +b = ushort 38284 +putu ulong b +c = uint 0 +putu ulong c +c = uint 1 +putu ulong c +c = uint 4294967295 +putu ulong c +c = uint 2147483648 +putu ulong c +c = uint 83920300 +putu ulong c +c = uint 1509667242 +putu ulong c +c = uint 3150959341 +putu ulong c +c = uint 3910442725 +putu ulong c +d = ulong 0 +putu d +d = ulong 1 +putu d +d = ulong 18446744073709551615 +putu d +d = ulong 9223372036854775808 +putu d +d = ulong 15205998013390911501 +putu d +d = ulong 16740117136465882709 +putu d +d = ulong 1684610389927020364 +putu d +d = ulong 6097465819152223959 +putu d +e = byte 0 +putu ulong e +e = byte 1 +putu ulong e +e = byte 127 +putu ulong e +e = byte 64 +putu ulong e +e = byte 55 +putu ulong e +e = byte 1 +putu ulong e +e = byte 35 +putu ulong e +e = byte 36 +putu ulong e +f = short 0 +putu ulong f +f = short 1 +putu ulong f +f = short 32767 +putu ulong f +f = short 16384 +putu ulong f +f = short 29462 +putu ulong f +f = short 18848 +putu ulong f +f = short 28453 +putu ulong f +f = short 23010 +putu ulong f +g = int 0 +putu ulong g +g = int 1 +putu ulong g +g = int 2147483647 +putu ulong g +g = int 1073741824 +putu ulong g +g = int 491140535 +putu ulong g +g = int 3657980 +putu ulong g +g = int 499641010 +putu ulong g +g = int 2038208288 +putu ulong g +h = long 0 +putu ulong h +h = long 1 +putu ulong h +h = long 9223372036854775807 +putu ulong h +h = long 4611686018427387904 +putu ulong h +h = long 2358124982775785610 +putu ulong h +h = long 5281094983814553355 +putu ulong h +h = long 6496971512538355926 +putu ulong h +h = long 4123693503557151770 +putu ulong h +ret 0 +end diff --git a/seed/omc/om2/hex/pairs-hex.om b/seed/omc/om2/hex/pairs-hex.om new file mode 100644 index 000000000..2064b1ab5 --- /dev/null +++ b/seed/omc/om2/hex/pairs-hex.om @@ -0,0 +1,136 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): 64 hex literals, eight per integer type (0, 1, the type maximum, +note the sign-bit or half value, four random values), each printed in decimal by lib putu. Values and +note spellings from Wolfram (wolfram.txt, query pairs). pairs-dec.om is the decimal spelling: same bytes. +om2 +fn main to int +a = uchar 0x0 +putu ulong a +a = uchar 0x1 +putu ulong a +a = uchar 0xff +putu ulong a +a = uchar 0x80 +putu ulong a +a = uchar 0xaa +putu ulong a +a = uchar 0x99 +putu ulong a +a = uchar 0x4b +putu ulong a +a = uchar 0x24 +putu ulong a +b = ushort 0x0 +putu ulong b +b = ushort 0x1 +putu ulong b +b = ushort 0xffff +putu ulong b +b = ushort 0x8000 +putu ulong b +b = ushort 0x5463 +putu ulong b +b = ushort 0x83b4 +putu ulong b +b = ushort 0x1e97 +putu ulong b +b = ushort 0x958c +putu ulong b +c = uint 0x0 +putu ulong c +c = uint 0x1 +putu ulong c +c = uint 0xffffffff +putu ulong c +c = uint 0x80000000 +putu ulong c +c = uint 0x50085ac +putu ulong c +c = uint 0x59fbb1aa +putu ulong c +c = uint 0xbbcfd2ed +putu ulong c +c = uint 0xe9149ee5 +putu ulong c +d = ulong 0x0 +putu d +d = ulong 0x1 +putu d +d = ulong 0xffffffffffffffff +putu d +d = ulong 0x8000000000000000 +putu d +d = ulong 0xd3068ea0db75f80d +putu d +d = ulong 0xe850d7d7b97a6e55 +putu d +d = ulong 0x1760f0396488474c +putu d +d = ulong 0x549e8cdb54a78ed7 +putu d +e = byte 0x0 +putu ulong e +e = byte 0x1 +putu ulong e +e = byte 0x7f +putu ulong e +e = byte 0x40 +putu ulong e +e = byte 0x37 +putu ulong e +e = byte 0x1 +putu ulong e +e = byte 0x23 +putu ulong e +e = byte 0x24 +putu ulong e +f = short 0x0 +putu ulong f +f = short 0x1 +putu ulong f +f = short 0x7fff +putu ulong f +f = short 0x4000 +putu ulong f +f = short 0x7316 +putu ulong f +f = short 0x49a0 +putu ulong f +f = short 0x6f25 +putu ulong f +f = short 0x59e2 +putu ulong f +g = int 0x0 +putu ulong g +g = int 0x1 +putu ulong g +g = int 0x7fffffff +putu ulong g +g = int 0x40000000 +putu ulong g +g = int 0x1d4635b7 +putu ulong g +g = int 0x37d0fc +putu ulong g +g = int 0x1dc7eab2 +putu ulong g +g = int 0x797c9720 +putu ulong g +h = long 0x0 +putu ulong h +h = long 0x1 +putu ulong h +h = long 0x7fffffffffffffff +putu ulong h +h = long 0x4000000000000000 +putu ulong h +h = long 0x20b9be2d8e53288a +putu ulong h +h = long 0x494a37e8475d1f0b +putu ulong h +h = long 0x5a29e12b10ae58d6 +putu ulong h +h = long 0x393a4d64aa1c2c1a +putu ulong h +ret 0 +end diff --git a/seed/omc/om2/hex/places-dec.om b/seed/omc/om2/hex/places-dec.om new file mode 100644 index 000000000..d4a4e7d84 --- /dev/null +++ b/seed/omc/om2/hex/places-dec.om @@ -0,0 +1,41 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of places-hex.om (values from Wolfram, wolfram.txt query tokens). +om2 +const KC uchar 200 +global g ulong 16 +fn rd t view uchar 8 to ulong +ret ulong get t 7 +end +fn wr s edit uchar 8 fresh to void +put s 7 90 +end +fn main to int +a = new uchar 8 0 +wr a +putu rd a +put g 15 7 +putu get g 15 +putu ulong KC +s = ulong 0 +for i ulong 4 unroll +s = add s i +end +putu s +k = ulong 0 +while lt k 100 bound 1000 +k = add k 1 +end +putu k +r = rotr uint 2147483649 31 +putu ulong r +q = rotl ulong 9223372036854775808 1 +putu q +f = f64 9007199254740993 +putu ulong f +h = f32 16777217 +putu ulong h +if eq k 0 +trap 14 +end +ret int and k 42 +end diff --git a/seed/omc/om2/hex/places-hex.om b/seed/omc/om2/hex/places-hex.om new file mode 100644 index 000000000..2efa47582 --- /dev/null +++ b/seed/omc/om2/hex/places-hex.om @@ -0,0 +1,44 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): a hex literal is accepted in every place a decimal one is: +note const value, global length, view and edit parameter lengths, new length and fill, put index and +note value, unroll count, while bound, rotr/rotl operands, f64/f32 conversion (rounded as decimal), +note trap code, and operand. Expected stdout and exit from Wolfram (wolfram.txt query places). +om2 +const KC uchar 0xc8 +global g ulong 0x10 +fn rd t view uchar 0x8 to ulong +ret ulong get t 0x7 +end +fn wr s edit uchar 0x8 fresh to void +put s 0x7 0x5a +end +fn main to int +a = new uchar 0x8 0x0 +wr a +putu rd a +put g 0xf 0x7 +putu get g 0xf +putu ulong KC +s = ulong 0x0 +for i ulong 0x4 unroll +s = add s i +end +putu s +k = ulong 0x0 +while lt k 0x64 bound 0x3e8 +k = add k 0x1 +end +putu k +r = rotr uint 0x80000001 0x1f +putu ulong r +q = rotl ulong 0x8000000000000000 0x1 +putu q +f = f64 0x20000000000001 +putu ulong f +h = f32 0x1000001 +putu ulong h +if eq k 0x0 +trap 0xe +end +ret int and k 0x2a +end diff --git a/seed/omc/om2/hex/ref/r23-globalbig-dec.om b/seed/omc/om2/hex/ref/r23-globalbig-dec.om new file mode 100644 index 000000000..494c16bc9 --- /dev/null +++ b/seed/omc/om2/hex/ref/r23-globalbig-dec.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r23-globalbig.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +global g uchar 16777217 +fn main to int +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r23-globalbig.om b/seed/omc/om2/hex/ref/r23-globalbig.om new file mode 100644 index 000000000..c1c99f9b0 --- /dev/null +++ b/seed/omc/om2/hex/ref/r23-globalbig.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): global length 0x1000001 past 16777216 (arrlen, error 23 as decimal); error 23 on the literal's line. +om2 +global g uchar 0x1000001 +fn main to int +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r6-17trunc.om b/seed/omc/om2/hex/ref/r6-17trunc.om new file mode 100644 index 000000000..b69b27a88 --- /dev/null +++ b/seed/omc/om2/hex/ref/r6-17trunc.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): 17 digits, error 6 before any truncation to 64 bits; error 6 on the literal's line. +om2 +fn main to int +x = ulong 0x10000000000000001 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r6-dot.om b/seed/omc/om2/hex/ref/r6-dot.om new file mode 100644 index 000000000..7a293540e --- /dev/null +++ b/seed/omc/om2/hex/ref/r6-dot.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): 0x1.8: no hex fraction; error 6 on the literal's line. +om2 +fn main to int +x = f64 0x1.8 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r6-lead00x.om b/seed/omc/om2/hex/ref/r6-lead00x.om new file mode 100644 index 000000000..25f50044c --- /dev/null +++ b/seed/omc/om2/hex/ref/r6-lead00x.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): 00x1 is not a hex literal; error 6 on the literal's line. +om2 +fn main to int +x = ulong 00x1 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r6-negX.om b/seed/omc/om2/hex/ref/r6-negX.om new file mode 100644 index 000000000..11e2e28ba --- /dev/null +++ b/seed/omc/om2/hex/ref/r6-negX.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): -0X1: minus and uppercase X; error 6 on the literal's line. +om2 +fn main to int +x = ulong -0X1 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r6-negbyte.om b/seed/omc/om2/hex/ref/r6-negbyte.om new file mode 100644 index 000000000..e5e80a539 --- /dev/null +++ b/seed/omc/om2/hex/ref/r6-negbyte.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): a - before a hex literal: signed minima have no hex spelling; error 6 on the literal's line. +om2 +fn main to int +x = byte -0x80 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r6-neglong.om b/seed/omc/om2/hex/ref/r6-neglong.om new file mode 100644 index 000000000..78cd068cd --- /dev/null +++ b/seed/omc/om2/hex/ref/r6-neglong.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): a - before a hex literal (long minimum); error 6 on the literal's line. +om2 +fn main to int +x = long -0x8000000000000000 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r6-xneg.om b/seed/omc/om2/hex/ref/r6-xneg.om new file mode 100644 index 000000000..3777fd73c --- /dev/null +++ b/seed/omc/om2/hex/ref/r6-xneg.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): 0x-1: digit outside 0-9a-f; error 6 on the literal's line. +om2 +fn main to int +x = long 0x-1 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-arg-dec.om b/seed/omc/om2/hex/ref/r8-arg-dec.om new file mode 100644 index 000000000..593a9b332 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-arg-dec.om @@ -0,0 +1,10 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-arg.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +fn f c uchar to ulong +ret ulong c +end +fn main to int +x = f 256 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-arg.om b/seed/omc/om2/hex/ref/r8-arg.om new file mode 100644 index 000000000..17165ce10 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-arg.om @@ -0,0 +1,10 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): call argument 0x100 for a uchar parameter (no truncation); error 8 on the literal's line. +om2 +fn f c uchar to ulong +ret ulong c +end +fn main to int +x = f 0x100 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-bound-dec.om b/seed/omc/om2/hex/ref/r8-bound-dec.om new file mode 100644 index 000000000..0c023d39b --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-bound-dec.om @@ -0,0 +1,10 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-bound.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +fn main to int +k = ulong 0 +while lt k 1 bound 1000000 +k = add k 1 +end +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-bound.om b/seed/omc/om2/hex/ref/r8-bound.om new file mode 100644 index 000000000..4409a38b3 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-bound.om @@ -0,0 +1,10 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): while bound 0xf4240 = 1000000 past 999999; error 8 on the literal's line. +om2 +fn main to int +k = ulong 0 +while lt k 1 bound 0xf4240 +k = add k 1 +end +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-cmp-dec.om b/seed/omc/om2/hex/ref/r8-cmp-dec.om new file mode 100644 index 000000000..0f3aa5656 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-cmp-dec.om @@ -0,0 +1,10 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-cmp.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +fn main to int +c = uchar 1 +if eq c 256 +ret 1 +end +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-cmp.om b/seed/omc/om2/hex/ref/r8-cmp.om new file mode 100644 index 000000000..068d2d10c --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-cmp.om @@ -0,0 +1,10 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): comparison operand 0x100 against uchar (no truncation); error 8 on the literal's line. +om2 +fn main to int +c = uchar 1 +if eq c 0x100 +ret 1 +end +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-const-dec.om b/seed/omc/om2/hex/ref/r8-const-dec.om new file mode 100644 index 000000000..7bf00f00c --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-const-dec.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-const.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +const KC uchar 256 +fn main to int +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-const.om b/seed/omc/om2/hex/ref/r8-const.om new file mode 100644 index 000000000..6090851b1 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-const.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): const value 0x100 outside uchar; error 8 on the literal's line. +om2 +const KC uchar 0x100 +fn main to int +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-fill-dec.om b/seed/omc/om2/hex/ref/r8-fill-dec.om new file mode 100644 index 000000000..519ab45a5 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-fill-dec.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-fill.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +fn main to int +a = new uchar 4 256 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-fill.om b/seed/omc/om2/hex/ref/r8-fill.om new file mode 100644 index 000000000..35aaca8dc --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-fill.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): new fill 0x100 for uchar (no truncation); error 8 on the literal's line. +om2 +fn main to int +a = new uchar 4 0x100 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-global0-dec.om b/seed/omc/om2/hex/ref/r8-global0-dec.om new file mode 100644 index 000000000..b7566c295 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-global0-dec.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-global0.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +global g ulong 0 +fn main to int +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-global0.om b/seed/omc/om2/hex/ref/r8-global0.om new file mode 100644 index 000000000..110b7f66c --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-global0.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): global length 0x0 (1..16777216); error 8 on the literal's line. +om2 +global g ulong 0x0 +fn main to int +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-lead0-dec.om b/seed/omc/om2/hex/ref/r8-lead0-dec.om new file mode 100644 index 000000000..560bd02bc --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-lead0-dec.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-lead0.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +fn main to int +x = uchar 256 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-lead0.om b/seed/omc/om2/hex/ref/r8-lead0.om new file mode 100644 index 000000000..e66f093c0 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-lead0.om @@ -0,0 +1,7 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): 0x0100: leading zeros do not change the value 256, out of uchar; error 8 on the literal's line. +om2 +fn main to int +x = uchar 0x0100 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-put-dec.om b/seed/omc/om2/hex/ref/r8-put-dec.om new file mode 100644 index 000000000..99f3c5601 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-put-dec.om @@ -0,0 +1,8 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-put.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +fn main to int +a = new uchar 4 0 +put a 0 256 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-put.om b/seed/omc/om2/hex/ref/r8-put.om new file mode 100644 index 000000000..26860b856 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-put.om @@ -0,0 +1,8 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): put value 0x100 into a uchar array (no truncation); error 8 on the literal's line. +om2 +fn main to int +a = new uchar 4 0 +put a 0 0x100 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-sub-dec.om b/seed/omc/om2/hex/ref/r8-sub-dec.om new file mode 100644 index 000000000..2eacbb957 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-sub-dec.om @@ -0,0 +1,8 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-sub.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +fn main to int +x = byte 1 +y = sub x 128 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-sub.om b/seed/omc/om2/hex/ref/r8-sub.om new file mode 100644 index 000000000..516870092 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-sub.om @@ -0,0 +1,8 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): sub operand 0x80 for byte (no two s-complement reinterpretation); error 8 on the literal's line. +om2 +fn main to int +x = byte 1 +y = sub x 0x80 +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-trap-dec.om b/seed/omc/om2/hex/ref/r8-trap-dec.om new file mode 100644 index 000000000..4f2258530 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-trap-dec.om @@ -0,0 +1,10 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-trap.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +fn main to int +k = ulong 0 +if eq k 1 +trap 15 +end +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-trap.om b/seed/omc/om2/hex/ref/r8-trap.om new file mode 100644 index 000000000..1d662c768 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-trap.om @@ -0,0 +1,10 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): trap code 0xf = 15 past 14; error 8 on the literal's line. +om2 +fn main to int +k = ulong 0 +if eq k 1 +trap 0xf +end +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-trap0-dec.om b/seed/omc/om2/hex/ref/r8-trap0-dec.om new file mode 100644 index 000000000..552756d32 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-trap0-dec.om @@ -0,0 +1,10 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-trap0.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +fn main to int +k = ulong 0 +if eq k 1 +trap 0 +end +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-trap0.om b/seed/omc/om2/hex/ref/r8-trap0.om new file mode 100644 index 000000000..75bca9964 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-trap0.om @@ -0,0 +1,10 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): trap code 0x0; error 8 on the literal's line. +om2 +fn main to int +k = ulong 0 +if eq k 1 +trap 0x0 +end +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-unroll-dec.om b/seed/omc/om2/hex/ref/r8-unroll-dec.om new file mode 100644 index 000000000..c5c24006a --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-unroll-dec.om @@ -0,0 +1,8 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-unroll.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +fn main to int +for i ulong 65 unroll +end +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-unroll.om b/seed/omc/om2/hex/ref/r8-unroll.om new file mode 100644 index 000000000..71514e1b0 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-unroll.om @@ -0,0 +1,8 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): unroll count 0x41 = 65 past 64; error 8 on the literal's line. +om2 +fn main to int +for i ulong 0x41 unroll +end +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-unroll0-dec.om b/seed/omc/om2/hex/ref/r8-unroll0-dec.om new file mode 100644 index 000000000..20184a4c0 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-unroll0-dec.om @@ -0,0 +1,8 @@ +note SPDX-License-Identifier: Apache-2.0 +note Decimal twin of r8-unroll0.om (value from Wolfram, wolfram.txt query tokens): same line, same error. +om2 +fn main to int +for i ulong 0 unroll +end +ret 0 +end diff --git a/seed/omc/om2/hex/ref/r8-unroll0.om b/seed/omc/om2/hex/ref/r8-unroll0.om new file mode 100644 index 000000000..ca2692036 --- /dev/null +++ b/seed/omc/om2/hex/ref/r8-unroll0.om @@ -0,0 +1,8 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): unroll count 0x0; error 8 on the literal's line. +om2 +fn main to int +for i ulong 0x0 unroll +end +ret 0 +end diff --git a/seed/omc/om2/hex/signed-min.om b/seed/omc/om2/hex/signed-min.om new file mode 100644 index 000000000..bb2737b00 --- /dev/null +++ b/seed/omc/om2/hex/signed-min.om @@ -0,0 +1,15 @@ +note SPDX-License-Identifier: Apache-2.0 +note spec/omegese-om2.md section 2 lines 53-58 (#745): signed minima are written in decimal (no - before hex); hex +note operands compare and add with them under the decimal range rule. Exit 0. +om2 +fn main to int +x = byte -128 +y = long -9223372036854775808 +if ge int x 0x0 +ret 1 +end +if ge y 0x0 +ret 2 +end +ret int add int x 0x80 +end diff --git a/seed/omc/om2/hex/target.txt b/seed/omc/om2/hex/target.txt new file mode 100644 index 000000000..306f34575 --- /dev/null +++ b/seed/omc/om2/hex/target.txt @@ -0,0 +1 @@ +target x86linux diff --git a/seed/omc/om2/hex/wolfram.txt b/seed/omc/om2/hex/wolfram.txt new file mode 100644 index 000000000..bab87e59a --- /dev/null +++ b/seed/omc/om2/hex/wolfram.txt @@ -0,0 +1,32 @@ +Wolfram receipt for seed/omc/om2/hex (#745). Tool: WolframLanguageEvaluator (agenttools.wolfram.com), 2026-10-30. +Every fixture spelling and expected value in this directory was produced by these queries and written +by script from the returned text; none was converted by hand. + +== query pairs +SeedRandom[745]; +ws = {{"uchar",8,0},{"ushort",16,0},{"uint",32,0},{"ulong",64,0},{"byte",8,1},{"short",16,1},{"int",32,1},{"long",64,1}}; +rows = Flatten[Table[With[{t=w[[1]], b=w[[2]], s=w[[3]]}, + With[{hi = If[s==1, 2^(b-1)-1, 2^b-1]}, + Map[{t, IntegerString[#,16], IntegerString[#,10], IntegerString[Mod[#,256],10]}&, Join[{0, 1, hi, If[s==1, 2^(b-2), 2^(b-1)]}, RandomInteger[{0,hi},4]]]]], {w, ws}], 1]; +StringRiffle[StringRiffle[#," "]& /@ rows, ";"] +-> uchar 0 0 0;uchar 1 1 1;uchar ff 255 255;uchar 80 128 128;uchar aa 170 170;uchar 99 153 153;uchar 4b 75 75;uchar 24 36 36;ushort 0 0 0;ushort 1 1 1;ushort ffff 65535 255;ushort 8000 32768 0;ushort 5463 21603 99;ushort 83b4 33716 180;ushort 1e97 7831 151;ushort 958c 38284 140;uint 0 0 0;uint 1 1 1;uint ffffffff 4294967295 255;uint 80000000 2147483648 0;uint 50085ac 83920300 172;uint 59fbb1aa 1509667242 170;uint bbcfd2ed 3150959341 237;uint e9149ee5 3910442725 229;ulong 0 0 0;ulong 1 1 1;ulong ffffffffffffffff 18446744073709551615 255;ulong 8000000000000000 9223372036854775808 0;ulong d3068ea0db75f80d 15205998013390911501 13;ulong e850d7d7b97a6e55 16740117136465882709 85;ulong 1760f0396488474c 1684610389927020364 76;ulong 549e8cdb54a78ed7 6097465819152223959 215;byte 0 0 0;byte 1 1 1;byte 7f 127 127;byte 40 64 64;byte 37 55 55;byte 1 1 1;byte 23 35 35;byte 24 36 36;short 0 0 0;short 1 1 1;short 7fff 32767 255;short 4000 16384 0;short 7316 29462 22;short 49a0 18848 160;short 6f25 28453 37;short 59e2 23010 226;int 0 0 0;int 1 1 1;int 7fffffff 2147483647 255;int 40000000 1073741824 0;int 1d4635b7 491140535 183;int 37d0fc 3657980 252;int 1dc7eab2 499641010 178;int 797c9720 2038208288 32;long 0 0 0;long 1 1 1;long 7fffffffffffffff 9223372036854775807 255;long 4000000000000000 4611686018427387904 0;long 20b9be2d8e53288a 2358124982775785610 138;long 494a37e8475d1f0b 5281094983814553355 11;long 5a29e12b10ae58d6 6496971512538355926 214;long 393a4d64aa1c2c1a 4123693503557151770 26 + +== query tokens +StringRiffle[Map[# <> "=" <> IntegerString[FromDigits[#,16],10] &, {"0","0100","1","10","100","1000001","1e","1e5","1f","1f32","1f64","20000000000001","2a","3e8","4","41","5a","5e10","64","7","8","80","8000000000000000","80000001","c8","e","e0f","ef","f","f32","f4240","fe"}], ";"] +-> 0=0;0100=256;1=1;10=16;100=256;1000001=16777217;1e=30;1e5=485;1f=31;1f32=7986;1f64=8036;20000000000001=9007199254740993;2a=42;3e8=1000;4=4;41=65;5a=90;5e10=24080;64=100;7=7;8=8;80=128;8000000000000000=9223372036854775808;80000001=2147483649;c8=200;e=14;e0f=3599;ef=239;f=15;f32=3890;f4240=1000000;fe=254 + +== query tokens2 +StringRiffle[Map[# <> "=" <> IntegerString[FromDigits[#,16],10] &, {"3","a","d","ff"}], ";"] +-> 3=3;a=10;d=13;ff=255 + +== query places +rotr[x_,n_,w_]:=BitOr[BitShiftRight[x,n],Mod[BitShiftLeft[x,w-n],2^w]]; +rotl[x_,n_,w_]:=rotr[x,Mod[w-n,w],w]; +f64[v_]:=Round[SetPrecision[N[v,40],40]]; +{FromDigits["5a",16], FromDigits["7",16], FromDigits["c8",16], Total[Range[0,FromDigits["4",16]-1]], FromDigits["64",16], + rotr[FromDigits["80000001",16], FromDigits["1f",16], 32], rotl[FromDigits["8000000000000000",16], 1, 64], + Module[{v=FromDigits["20000000000001",16], e}, e=Floor[Log2[v]]; With[{u=2^(e-52)}, u*Round[v/u]]], + Module[{v=FromDigits["1000001",16], e}, e=Floor[Log2[v]]; With[{u=2^(e-23)}, u*Round[v/u]]], + BitAnd[FromDigits["64",16], FromDigits["2a",16]], + Mod[FromDigits["1f",16]+FromDigits["ef",16], 256], FromDigits["1f",16]+FromDigits["ef",16]} +-> Out[1]= {90, 7, 200, 6, 100, 3, 1, 9007199254740992, 16777216, 32, 14, 270}