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/omega-mv/blob/main/seed/omc/gate7.sh # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / seed / omc / gate7.sh` 75 lines ยท 1997 bytes Raw Blame History 1 #!/bin/sh 2 # gate7.sh -- break, continue and trap (OMEGESE 9.8). The compiler under test is seed/out/omc, which 3 # seed/omega-from-seed.sh has already built and proved self-identical. om4 refuses all three words 4 # (they are omc-only), and that refusal is checked here too. RC=0 only when every case passed. 5 set -eu 6 R=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd) 7 cd "$R" 8 B=build/seed/r7 9 T=seed/omc/tests/loop 10 S=seed/out/omc 11 OM4=seed/rung4/om4.bin 12 mkdir -p "$B" 13 [ -x "$S" ] || { printf 'FAIL: %s missing; run sh seed/omega-from-seed.sh first\n' "$S" >&2; exit 1; } 14 bad() { printf 'FAIL: %s\n' "$*" >&2; exit 1; } 15 say() { printf '%s\n' "$*"; } 16 17 # om4 has neither word: each such line must be refused, never compiled. 18 for f in w1.om c2.om t1.om; do 19 set +e 20 "$OM4" < "$T/$f" > "$B/om4-$f.bin" 2> "$B/om4-$f.err" 21 orc=$? 22 set -e 23 [ "$orc" != 0 ] || bad "om4 accepted $f (break/trap are omc-only)" 24 done 25 say "PASS om4 refuses break and trap" 26 27 n=0 28 run_exit() { # name expect 29 n=$((n+1)) 30 set +e 31 "$S" < "$T/$1.om" > "$B/$1.bin" 2> "$B/$1.err" 32 crc=$? 33 set -e 34 [ "$crc" = 0 ] || bad "$1: compiler exit $crc ($(cat "$B/$1.err"))" 35 chmod +x "$B/$1.bin" 36 set +e 37 "$B/$1.bin" > /dev/null 38 rrc=$? 39 set -e 40 [ "$rrc" = "$2" ] || bad "$1: ran $rrc, wanted $2" 41 say "PASS $1 exit $rrc" 42 } 43 44 refuse() { # name expect-error 45 n=$((n+1)) 46 set +e 47 "$S" < "$T/$1.om" > "$B/$1.bin" 2> "$B/$1.err" 48 crc=$? 49 set -e 50 [ "$crc" = "$2" ] || bad "$1: compiler exit $crc, wanted $2 ($(cat "$B/$1.err"))" 51 grep -q "error $2" "$B/$1.err" || bad "$1: diagnostic does not name error $2" 52 say "PASS $1 error $2" 53 } 54 55 run_exit w1 6 56 run_exit f1 3 57 run_exit n1 33 58 run_exit n2 4 59 run_exit n3 3 60 run_exit c1 18 61 run_exit c2 12 62 run_exit c3 36 63 run_exit c4 0 64 run_exit c5 104 65 run_exit t1 105 66 run_exit t2 107 67 refuse bad_outside 9 68 refuse bad_after 17 69 refuse bad_continue 9 70 refuse bad_after_continue 17 71 refuse bad_trap0 8 72 refuse bad_trap15 8 73 74 say "PASS gate7 $n cases" 75 exit 0