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
omega-mv / research / om-bench / controls / brk-main.om
| 1 | text yes "yes\n" |
| 2 | text no "no\n" |
| 3 | fn main to int |
| 4 | n = readall |
| 5 | d = long 0 |
| 6 | ok = true |
| 7 | for i ulong n |
| 8 | c = get inb i |
| 9 | if eq c 40 |
| 10 | d = add d 1 |
| 11 | end |
| 12 | if eq c 41 |
| 13 | d = sub d 1 |
| 14 | if lt d 0 |
| 15 | ok = false |
| 16 | end |
| 17 | end |
| 18 | end |
| 19 | if ne d 0 |
| 20 | ok = false |
| 21 | end |
| 22 | if ok |
| 23 | k = write 1 yes 0 len yes |
| 24 | else |
| 25 | k = write 1 no 0 len no |
| 26 | end |
| 27 | ret 0 |
| 28 | end |