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 / seed / omc / gate11.sh

37 lines · 1223 bytes Raw Blame History
1#!/bin/sh
2# gate11.sh -- reserved-word compatibility. The benchmark corpus used bits, min, max, abs and sqrt as
3# ordinary names, so those spellings are not keywords; the float words are bitcast/fsqrt/fabs/fmin/
4# fmax. This gate pins both halves of that rule. RC=0 only when every case below passed.
5set -eu
6R=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd)
7cd "$R"
8B=build/seed/r11
9T=seed/omc/tests/keywords
10S=seed/out/omc
11mkdir -p "$B"
12[ -x "$S" ] || { printf 'FAIL: %s missing; run sh seed/omega-from-seed.sh first\n' "$S" >&2; exit 1; }
13bad() { printf 'FAIL: %s\n' "$*" >&2; exit 1; }
14say() { printf '%s\n' "$*"; }
15
16set +e
17"$S" < "$T/names.om" > "$B/names.bin" 2> "$B/names.err"
18crc=$?
19set -e
20[ "$crc" = 0 ] || bad "names: compiler exit $crc ($(cat "$B/names.err"))"
21chmod +x "$B/names.bin"
22set +e
23"$B/names.bin" > /dev/null
24rrc=$?
25set -e
26[ "$rrc" = 10 ] || bad "names: ran $rrc, wanted 10"
27say "PASS names exit 10 (bits/min/max/abs/sqrt usable as names)"
28
29set +e
30"$S" < "$T/neg_reserved.om" > "$B/neg.bin" 2> "$B/neg.err"
31crc=$?
32set -e
33[ "$crc" = 16 ] || bad "neg_reserved: compiler exit $crc, wanted 16 ($(cat "$B/neg.err"))"
34say "PASS neg_reserved error 16 (bitcast is a keyword)"
35
36say "PASS gate11 2 cases"
37exit 0