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/research/om-bench/controls/brk-ref.om # 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 / research / om-bench / controls / brk-ref.om` 63 lines ยท 834 bytes Raw Blame History 1 note Read unsigned decimal numbers separated by spaces or newlines from stdin; print their sum. 2 global inb uchar 65536 3 global outb uchar 32 4 fn readall to ulong 5 n = ulong 0 6 while lt n 65536 bound 65537 7 k = read 0 inb n sub 65536 n 8 if lt k 0 9 exit 2 10 end 11 if eq k 0 12 break 13 end 14 n = add n ulong k 15 end 16 ret n 17 end 18 fn printu v ulong to void 19 i = ulong 31 20 put outb i 10 21 x = v 22 while true bound 21 23 i = sub i 1 24 put outb i uchar add rem x 10 48 25 x = div x 10 26 if eq x 0 27 break 28 end 29 end 30 off = i 31 k = write 1 outb off sub 32 off 32 if ne k long sub 32 off 33 exit 3 34 end 35 end 36 text yes "yes\n" 37 text no "no\n" 38 fn main to int 39 n = readall 40 d = long 0 41 ok = true 42 for i ulong n 43 c = get inb i 44 if eq c 40 45 d = add d 1 46 end 47 if eq c 41 48 d = sub d 1 49 if lt d 0 50 ok = false 51 end 52 end 53 end 54 if ne d 0 55 ok = false 56 end 57 if ok 58 k = write 1 yes 0 len yes 59 else 60 k = write 1 no 0 len no 61 end 62 ret 0 63 end