omega-mcp
aien-dev/omega-mcp
Brought by drakestapleton
omega-mcp / data / examples / om2_abstract.om
| 1 | om2 |
| 2 | note abstract types: values made only by seal in NAMEmk, read by open, operations listed by ops; |
| 3 | note holds dup32 checks every seal at run time (trap 10) |
| 4 | abstract tag uint ops and or |
| 5 | abstract dup32 ulong ops xor |
| 6 | holds dup32 dup32 |
| 7 | fn tagmk x uint to tag |
| 8 | ret seal tag x |
| 9 | end |
| 10 | fn dup32mk x uint to dup32 |
| 11 | ret seal dup32 or shl ulong x 32 ulong x |
| 12 | end |
| 13 | fn main to int |
| 14 | t = or tagmk 12 tagmk 3 |
| 15 | u = and t tagmk 5 |
| 16 | d = xor dup32mk 7 dup32mk 4 |
| 17 | if ne open d 12884901891 |
| 18 | ret 1 |
| 19 | end |
| 20 | ret int open u |
| 21 | end |