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 / profile / cases / ok-unit.om

45 lines · 714 bytes Raw Blame History
1note Positive unit: every rule satisfied, with each annotation form.
2const LIM ulong 16
3global buf uchar 64
4text path "build/profile-ok"
5note p10 pure
6fn twice x ulong to ulong
7ret add x x
8end
9note p10 effect
10fn save n ulong to ulong
11fd = fopen path 0 len path 577 384
12if lt fd 0
13ret 1
14end
15w = write int fd buf 0 n
16note p10 allow E1 the write status is reported; a close error after it is not
17cl = fclose int fd
18if ne w long n
19ret 2
20end
21ret 0
22end
23fn walk depth ulong to ulong
24nd = add depth 1
25if gt nd LIM
26ret 0
27end
28ret walk nd
29end
30fn main to int
31s = ulong 0
32for i ulong len buf
33s = add s twice i
34end
35k = ulong 0
36while lt k 10 bound 10
37k = add k 1
38end
39r = save 8
40if ne r 0
41ret 1
42end
43d = walk 0
44ret int add d s
45end