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 / sites / found-stmt-1.om

61 lines · 936 bytes Raw Blame History
1note sites: found by a one-token change of a tracked program (41 to 120 lines); reaches the omc error site in stmt (code 7)
2note Read unsigned decimal numbers separated by spaces or newlines from stdin; print their sum.
3global inb uchar 65536
4global outb uchar 32
5fn readall to ulong
6n = ulong 0
7while lt n 65536 bound 65537
8k = read 0 inb n sub 65536 n
9if lt k 0
10exit 2
11end
12if eq k 0
13break
14end
15n = add n ulong k
16end
17ret n
18end
19fn printu v ulong to void
20i = ulong 31
21put outb i 10
22x = v
23while true bound 21
24i = sub i 1
25put outb i uchar add rem x 10 48
26x = div x 10
27if eq x 0
28break
29end
30end
31off = i
32k = write 1 outb off sub 32 off
33if ne k long sub 32 off
34exit true
35end
36end
37text yes "yes\n"
38text no "no\n"
39fn main to int
40n = readall
41d = long 0
42ok = true
43for i ulong n
44c = get inb i
45if eq c 40
46d = add d 1
47end
48if eq c 41
49d = sub d 1
50if lt d 0
51ok = false
52end
53end
54end
55if ok
56k = write 1 yes 0 len yes
57else
58k = write 1 no 0 len no
59end
60ret 0
61end