interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / bench / omc_efficiency / kernels / fib.om

33 lines · 688 bytes Raw Blame History
1note fib: doubly recursive Fibonacci of 38 (ulong); prints fib(38). Call and return heavy.
2note OMC-EFF-2: main writes the nanoseconds between its two monons readings (the computation, without
3note start-up and output) as one decimal line on stderr; stdout is unchanged.
4global out uchar 32
5fn putnum fd int v ulong to void
6put out 31 10
7p = ulong 31
8x = v
9while gt x 9
10p = sub p 1
11put out p uchar add rem x 10 48
12x = div x 10
13end
14p = sub p 1
15put out p uchar add x 48
16w = write fd out p sub 32 p
17end
18fn fib n ulong to ulong
19if lt n 2
20ret n
21end
22a = fib sub n 1
23b = fib sub n 2
24ret add a b
25end
26fn main to int
27t0 = monons
28r = fib 38
29t1 = monons
30putnum 2 ulong sub t1 t0
31putnum 1 r
32ret 0
33end