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 / semhash / cases / inv_alpha.om

71 lines · 1199 bytes Raw Blame History
1om2
2note semhash fixture: the base unit every case is diffed against
3const lim ulong 7
4global buf uchar 16
5struct pt px uint py uint end
6layout lay 8
7field fa uchar at 0 little
8field fb ushort at 1 little
9end
10fn leaf m ulong k ulong to ulong
11ret add m k
12end
13fn mid xx ulong to ulong
14yy = leaf xx 3
15ret mul yy 2
16end
17fn top k ulong to ulong
18z = mid k
19ret add z 1
20end
21fn other w ulong to ulong
22ret xor w 5
23end
24fn psub lhs ulong rhs ulong to ulong
25ret sub lhs rhs
26end
27fn useconst val ulong to ulong
28ret add val lim
29end
30fn useglob j ulong to ulong
31put buf 0 uchar j
32ret len buf
33end
34fn callargs uu ulong to ulong
35ret psub uu 2
36end
37fn rdlay cc view lay ii ulong to ulong
38ret ulong get cc ii
39end
40fn sumpt s view pt to ulong
41w = ulong get s px
42ret add w ulong get s py
43end
44fn iseven m ulong to bool
45if eq m 0
46ret true
47end
48ret isodd sub m 1
49end
50fn isodd k ulong to bool
51if eq k 0
52ret false
53end
54ret iseven sub k 1
55end
56fn main to int
57arr = new uchar 8 0
58put arr 1 9
59pp = new pt 3 4
60acc = add top 1 other 2
61acc = add acc psub 9 4
62acc = add acc useconst 1
63acc = add acc useglob 2
64acc = add acc callargs 5
65acc = add acc rdlay arr 1
66acc = add acc sumpt pp
67if iseven acc
68acc = add acc 64
69end
70ret int rem acc 251
71end