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 / train / omega-llm / tools / combined / experiment / predict.om
| 1 | text tPrintLine "prl\n" |
| 2 | note Harness only. Usage: predict KIT SCRATCH OMC PROMPT BODY INPUTS. |
| 3 | note INPUTS contains arguments alone. Each run prints one result row per input in bench-out. |
| 4 | fn emitInput p ulong q ulong sh ulong to void |
| 5 | width = sh |
| 6 | if ge sh 4 |
| 7 | width = 9 |
| 8 | end |
| 9 | p = skipsp p q |
| 10 | if ne nwords p q width |
| 11 | die badinput 65 |
| 12 | end |
| 13 | if le sh 3 |
| 14 | gtx gprv |
| 15 | gtx gcall |
| 16 | for j ulong width |
| 17 | w = wordend p q |
| 18 | gtx gsul |
| 19 | gu canonical p w |
| 20 | p = skipsp w q |
| 21 | end |
| 22 | gc 10 |
| 23 | else |
| 24 | w = wordend p q |
| 25 | n = canonical p w |
| 26 | if gt n 8 |
| 27 | die badinput 65 |
| 28 | end |
| 29 | p = skipsp w q |
| 30 | for j ulong 8 |
| 31 | w = wordend p q |
| 32 | gtx setarr |
| 33 | gu j |
| 34 | numberarg canonical p w |
| 35 | gc 10 |
| 36 | p = skipsp w q |
| 37 | end |
| 38 | if eq sh 4 |
| 39 | gtx gprv |
| 40 | end |
| 41 | gtx gcall |
| 42 | gtx garrul |
| 43 | gu n |
| 44 | gc 10 |
| 45 | if eq sh 5 |
| 46 | gtx gpra |
| 47 | end |
| 48 | end |
| 49 | gtx tPrintLine |
| 50 | end |
| 51 | |
| 52 | |
| 53 | fn main to int |
| 54 | if ne argcnt 7 |
| 55 | die badinput 2 |
| 56 | end |
| 57 | put st 26 2 |
| 58 | put st 27 3 |
| 59 | readprompt |
| 60 | pclr |
| 61 | parg 5 |
| 62 | b = cbLoad 65535 |
| 63 | e = get st 6 |
| 64 | z = bodyend b e |
| 65 | if eq z 0 |
| 66 | ret 1 |
| 67 | end |
| 68 | if or more sub z 1 e not mathbody b e |
| 69 | ret 1 |
| 70 | end |
| 71 | put st 2 0 |
| 72 | gmem get cfg 1 sub get cfg 2 get cfg 1 |
| 73 | gc 10 |
| 74 | gmem b sub e b |
| 75 | gc 10 |
| 76 | gtx gpre |
| 77 | gtx gmain0 |
| 78 | validateNames |
| 79 | sh = get cfg 3 |
| 80 | if ge sh 4 |
| 81 | gtx garr0 |
| 82 | end |
| 83 | pclr |
| 84 | parg 6 |
| 85 | p = cbLoad 65535 |
| 86 | e = get st 6 |
| 87 | while lt p e bound 65536 |
| 88 | q = lend p e |
| 89 | emitInput p q sh |
| 90 | p = add q 1 |
| 91 | end |
| 92 | gtx gmainz |
| 93 | rc = compile |
| 94 | if eq rc 127 |
| 95 | die failure 70 |
| 96 | end |
| 97 | if ne rc 0 |
| 98 | ret 1 |
| 99 | end |
| 100 | if ne runp true 0 |
| 101 | ret 2 |
| 102 | end |
| 103 | ret 0 |
| 104 | end |