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 / omc / om2 / s5 / scrub-live.om
| 1 | note S5 scrub: live values survive. Parameters, register locals, a local array above SP, the held left operand |
| 2 | note of an expression and an earlier call argument keep their values across scrub. Exit 0, else the check. |
| 3 | om2 |
| 4 | fn two a ulong b ulong c ulong to ulong |
| 5 | ret add mul a 100 add mul b 10 c |
| 6 | end |
| 7 | fn keep a ulong b ulong c ulong to ulong |
| 8 | arr = new ulong 4 7 |
| 9 | put arr 3 a |
| 10 | x = add a b |
| 11 | y = add x ulong scrub 4096 |
| 12 | if ne y x |
| 13 | ret 1 |
| 14 | end |
| 15 | if ne a 11 |
| 16 | ret 2 |
| 17 | end |
| 18 | if ne b 22 |
| 19 | ret 3 |
| 20 | end |
| 21 | if ne c 33 |
| 22 | ret 4 |
| 23 | end |
| 24 | if ne get arr 3 11 |
| 25 | ret 5 |
| 26 | end |
| 27 | if ne get arr 0 7 |
| 28 | ret 6 |
| 29 | end |
| 30 | z = add mul a 1000 add b ulong scrub 16 |
| 31 | if ne z 11022 |
| 32 | ret 7 |
| 33 | end |
| 34 | w = two 4 ulong scrub 1048576 6 |
| 35 | if ne w 406 |
| 36 | ret 8 |
| 37 | end |
| 38 | if ne x 33 |
| 39 | ret 9 |
| 40 | end |
| 41 | ret 0 |
| 42 | end |
| 43 | fn main to int |
| 44 | p = ulong 5 |
| 45 | q = long 9 |
| 46 | r = keep 11 22 33 |
| 47 | if ne r 0 |
| 48 | ret int r |
| 49 | end |
| 50 | k = scrub 64 |
| 51 | if ne p 5 |
| 52 | ret 20 |
| 53 | end |
| 54 | if ne q 9 |
| 55 | ret 21 |
| 56 | end |
| 57 | if ne k 0 |
| 58 | ret 22 |
| 59 | end |
| 60 | ret 0 |
| 61 | end |