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 / benchmarks / native / neuralese / nl1r / io.om

140 lines · 2414 bytes Raw Blame History
1om2
2note NL6 continuation: independent strict parser, never reads producer summaries.
3const JCAP ulong 16384
4global JBuf uchar JCAP
5global JIo ulong 2
6global JC ulong 8
7global JR ulong 50
8global JP f64 83
9global JH f64 4
10global JU f64 8
11global JS f64 4
12global JB uchar 32
13global Seen ulong 15
14global Logs uchar 7680
15global Sizes ulong 240
16global Stats ulong 360
17text JBAD "NL1RJ INVALID\n"
18text JMAG "NL1RJ1,schema,unit,seed,trainmask,group,partition,total,exact,accepted_correct,wrong_accepted,abstained,feature_errors,collision_pairs,encode_ns,decode_ns\n"
19text JREC "M,"
20text JSEP ","
21text JLF "\n"
22text JEND "NL1RJ END\n"
23fn jout a view uchar * to void
24p = ulong 0
25while lt p len a
26n = write 1 a p sub len a p
27if le n 0
28exit 93
29end
30p = add p ulong n
31end
32end
33fn jinvalid to void
34n = write 2 JBAD 0 len JBAD
35exit 90
36end
37fn jnext to long
38if eq get JIo 0 get JIo 1
39n = read 0 JBuf 0 JCAP
40if lt n 0
41jinvalid
42end
43if eq n 0
44ret -1
45end
46put JIo 0 0
47put JIo 1 ulong n
48end
49p = get JIo 0
50put JIo 0 add p 1
51ret long get JBuf p
52end
53fn jexpect c long to void
54if ne jnext c
55jinvalid
56end
57end
58fn jvalue delim long to ulong
59v = ulong 0
60n = ulong 0
61first = long -1
62while true bound 21
63c = jnext
64if eq c delim
65if eq n 0
66jinvalid
67end
68if and gt n 1 eq first 48
69jinvalid
70end
71ret v
72end
73if or lt c 48 gt c 57
74jinvalid
75end
76if eq n 0
77first = c
78end
79if or gt v 1844674407370955161 and eq v 1844674407370955161 gt c 53
80jinvalid
81end
82v = add mul v 10 ulong sub c 48
83n = add n 1
84end
85ret 0
86end
87fn jnumber v ulong to void
88b = new uchar 20 0
89p = ulong 20
90while true bound 20
91p = sub p 1
92put b p uchar add rem v 10 48
93v = div v 10
94if eq v 0
95break
96end
97end
98while lt p 20 bound 20
99n = write 1 b p sub ulong 20 p
100if le n 0
101exit 93
102end
103p = add p ulong n
104end
105end
106fn jfield v ulong to void
107jnumber v
108jout JSEP
109end
110fn jparity id ulong to ulong
111ret and xor xor xor id shr id 1 shr id 2 shr id 3 1
112end
113fn jsoft x f64 to f64
114ret div x add 1.0f64 fabs x
115end
116fn jrelu x f64 to f64
117if gt x 0.0f64
118ret x
119end
120ret 0.0f64
121end
122fn jstore k ulong v ulong to void
123for b ulong 8
124put JB add mul k 8 b uchar and shr v mul b 8 255
125end
126end
127fn jload k ulong to ulong
128v = ulong 0
129for b ulong 8
130v = or v shl get JR add 3 add mul k 8 b mul b 8
131end
132ret v
133end
134fn jstat group ulong phase ulong col ulong to ulong
135ret add mul add mul group 3 phase 8 col
136end
137fn jinc group ulong phase ulong col ulong val ulong to void
138ix = jstat group phase col
139put Stats ix add get Stats ix val
140end