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 / neighbours.om
| 1 | note neighbours.om: put on a bool field must not touch the fields around it, and a put on a |
| 2 | note neighbour must not touch the bool. Fields a=11 f=true b=22 g=false c=33; f is put false, |
| 3 | note g is put true. Bits: f false 1, g true 2, a+b+c = 66 (total 69). Then a b c become 1 2 3: |
| 4 | note f false 4, g true 8, a+b+c = 6. Result 69 + 12 + 6 = 87. |
| 5 | struct N a uint f bool b uint g bool c uchar end |
| 6 | fn main to uint |
| 7 | n = new N 11 true 22 false 33 |
| 8 | put n f false |
| 9 | put n g true |
| 10 | r = uint 0 |
| 11 | if eq get n f false |
| 12 | r = add r 1 |
| 13 | end |
| 14 | if eq get n g true |
| 15 | r = add r 2 |
| 16 | end |
| 17 | r = add r get n a |
| 18 | r = add r get n b |
| 19 | r = add r uint get n c |
| 20 | put n a 1 |
| 21 | put n b 2 |
| 22 | put n c 3 |
| 23 | if eq get n f false |
| 24 | r = add r 4 |
| 25 | end |
| 26 | if eq get n g true |
| 27 | r = add r 8 |
| 28 | end |
| 29 | r = add r get n a |
| 30 | r = add r get n b |
| 31 | r = add r uint get n c |
| 32 | ret r |
| 33 | end |