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 / si / mcp / data / examples / arith.om

39 lines · 481 bytes Raw Blame History
1note signed and unsigned arithmetic, bit operations, comparisons and not
2fn main to int
3a = int 17
4b = int 5
5s = add a b
6s = sub s mul a b
7s = add s div a b
8s = add s rem a b
9x = uint 12
10x = and x 10
11x = or x 3
12x = xor x 6
13x = shl x 2
14x = shr x 1
15n = neg s
16k = int 0
17if eq n 58
18k = add k 1
19end
20if ne a b
21k = add k 1
22end
23if lt b a
24k = add k 1
25end
26if le a 17
27k = add k 1
28end
29if gt a b
30k = add k 1
31end
32if ge b 5
33k = add k 1
34end
35if not lt a b
36k = add k 1
37end
38ret add add n int x k
39end