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 / tests / struct-bool / array_fields.om
| 1 | note array_fields.om: a bool field between two array fields h and t (4 uchar each). The ends of |
| 2 | note each array are written, the bool is written, then an end is written again; no write may |
| 3 | note move another field. h = 7 7 7 4, t = 6 9 9 9, f: true seen (1) then false seen (2). |
| 4 | note Result 3 + h0 7 + h3 4 + h1 7 + t0 6 + t3 9 + t2 9 = 45. |
| 5 | struct A h uchar 4 f bool t uchar 4 end |
| 6 | fn main to uint |
| 7 | a = new A 7 true 9 |
| 8 | put a h 3 5 |
| 9 | put a t 0 6 |
| 10 | r = uint 0 |
| 11 | if eq get a f true |
| 12 | r = add r 1 |
| 13 | end |
| 14 | put a f false |
| 15 | put a h 3 4 |
| 16 | if eq get a f false |
| 17 | r = add r 2 |
| 18 | end |
| 19 | r = add r uint get a h 0 |
| 20 | r = add r uint get a h 3 |
| 21 | r = add r uint get a h 1 |
| 22 | r = add r uint get a t 0 |
| 23 | r = add r uint get a t 3 |
| 24 | r = add r uint get a t 2 |
| 25 | ret r |
| 26 | end |