Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/tools/exp445/arms/omegese.md # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tools / exp445 / arms / omegese.md` 100 lines ยท 5381 bytes Raw Blame History Rendered 1 REPRESENTATION: omegese 2 3 Write the program in Omegese: one statement per line, words separated by single spaces. No commas, 4 no semicolons, no indentation, no comments. A checker reads it line by line and refuses 5 the first invalid line with a reason; a valid program becomes the program. 6 7 Types (Omegese name = type): bool = bool, uchar = u8, ushort = u16, uint = u32, ulong = u64, 8 byte = i8, short = i16, int = i32, long = i64. The names u8 .. i64 are accepted too. 9 10 Statements: 11 12 fn ... to (or: to void); end closes the function 13 = write a value: a new name, or an existing name of the same type 14 if ... else ... end (else is optional) 15 while bound ... end N in 1..`1000000`; more than N iterations is trap 4 16 for ... end i = 0, 1, ..., count-1 (count is a number or a value) 17 break leave the innermost while or for 18 ret (ret alone in a void function) 19 put 20 free 21 trap code 1..14; like ret, it ends the path 22 call a void function 23 24 Values (each op takes a fixed number of values; each value may itself be an op): 25 26 or 27 add sub mul div rem and or xor shl shr 28 eq ne lt le gt ge (gives bool) 29 neg (signed) not (bool: logical; number: bitwise) 30 a typed number, e.g. uint 0 31 convert, e.g. ulong x (trap 5 if the value does not fit) 32 get 33 new only as a whole line: = new ... 34 own edit view 35 call a function written earlier in the program 36 37 Values nest in prefix order: `add mul a a 1` is (a*a)+1, `eq rem n 2 0` is n%2 == 0. Brackets are 38 optional and change nothing: `add (mul a a) 1`. A ( must hold exactly one value. 39 40 Rules: 41 - Types are inferred: a new name takes the type of its value. A plain number takes the type of the 42 other value of its op (`add x 1`); where there is none, write the type (`s = uint 0`). Both values 43 of an op have one type; convert explicitly. Two plain numbers in one op are refused. 44 - A condition is any value giving bool (`while ne b 0 bound 64`, `if or lt p 0 gt p 9`). 45 - A name first written inside if/else/while/for exists only until that block's end. To use a value 46 after the block, write it before the block, then overwrite it inside. 47 - Every name you write must be read later. Parameters may be overwritten. A for counter may not. 48 - Every path through a function that returns a value must end in ret or trap. 49 - Parameters of array type: own|edit|view , e.g. `v view uint 4`. 50 51 Word card: every fixed word and what it does. 52 53 fn start a function: fn ... to 54 to in a fn line: the return type follows 55 void in a fn line: the function returns nothing (to void) 56 end close the innermost fn, if, else, while or for 57 if if : run the lines up to else or end when cond is true 58 else the lines run when the if condition is false 59 while while bound : repeat while cond is true 60 bound in a while line: the most passes allowed; one more is trap 4 61 for for : run with i = 0, 1, ..., count-1 62 break leave the innermost while or for 63 ret return a value (ret alone in a void function) 64 trap trap : stop the run with that trap code 65 put put : store into an array 66 free free : release an array made with new 67 true the bool value true 68 false the bool value false 69 add add : a + b 70 sub sub : a - b 71 mul mul : a * b 72 div div : a / b, truncated toward zero 73 rem rem : remainder of a / b, sign of a 74 and and : bitwise and; on bools, logical and 75 or or : bitwise or; on bools, logical or 76 xor xor : bitwise exclusive or 77 shl shl : a shifted left by b bits 78 shr shr : a shifted right by b bits 79 eq eq : a == b (bool) 80 ne ne : a != b (bool) 81 lt lt : a < b (bool) 82 le le : a <= b (bool) 83 gt gt : a > b (bool) 84 ge ge : a >= b (bool) 85 neg neg : -a (signed) 86 not not : logical not of a bool, bitwise not of a number 87 get get : read an element 88 new = new : a new array of len elements, all init 89 bool type bool; bool converts or types a value 90 uchar type u8 (unsigned 8-bit); uchar converts or types a value 91 ushort type u16 (unsigned 16-bit) 92 uint type u32 (unsigned 32-bit) 93 ulong type u64 (unsigned 64-bit) 94 byte type i8 (signed 8-bit) 95 short type i16 (signed 16-bit) 96 int type i32 (signed 32-bit) 97 long type i64 (signed 64-bit) 98 own own : move the array (a parameter: own ) 99 edit edit : lend the array for writing (a parameter: edit ) 100 view view : lend the array for reading (a parameter: view )