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 / ng / a64 / tests / front / fib39.om
| 1 | note rgate front-phase negative control: seed/ng/front/kernels/fib40.om with fib 39 in main. omc compiles this |
| 2 | note file as the reference for fib40's front-ir and a64 build; the stdout lines (63245986 against 102334155) must differ. |
| 3 | global out uchar 32 |
| 4 | fn fib n ulong to ulong |
| 5 | if lt n 2 |
| 6 | ret n |
| 7 | end |
| 8 | a = fib sub n 1 |
| 9 | b = fib sub n 2 |
| 10 | ret add a b |
| 11 | end |
| 12 | fn putnum v ulong to void |
| 13 | put out 31 10 |
| 14 | p = ulong 31 |
| 15 | x = v |
| 16 | while gt x 9 |
| 17 | p = sub p 1 |
| 18 | put out p uchar add rem x 10 48 |
| 19 | x = div x 10 |
| 20 | end |
| 21 | p = sub p 1 |
| 22 | put out p uchar add x 48 |
| 23 | w = write 1 out p sub 32 p |
| 24 | end |
| 25 | fn main to int |
| 26 | putnum fib 39 |
| 27 | ret 0 |
| 28 | end |