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