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/om/encoder/guard_words.om # 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 / om / encoder / guard_words.om` 86 lines ยท 1440 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note guard_words.om: one line per op 0..63 and form 0 (always), 1 (@P0), 2 (@!P0). 3 note Concatenate after either bw_enc_sm121.om. The guard gate runs it on both copies. 4 note Line: op form status guard w0 w1 w2 w3 5 note status 0 accepted, 1 refused. guard is 99 when refused, else w0 bits 12..15. 6 note No arguments. Exit 0. 7 text gwsp " " 8 text gwnl "\n" 9 10 note encode op with form f (0 none, 1 @P0, 2 @!P0) into w; enc1's result (0 accepted) 11 fn gw_enc op ulong f ulong w edit ulong 4 to ulong 12 o = new ulong 16 0 13 put o 0 op 14 put o 1 4 15 put o 2 8 16 put o 3 12 17 put o 4 16 18 put o 5 4 19 if or eq op 46 eq op 54 20 put o 6 2 21 end 22 if eq op 11 23 put o 6 64 24 end 25 put o 12 1 26 put o 13 1 27 put o 14 1 28 put o 15 1 29 if ne f 0 30 put o 9 1 31 end 32 if eq f 2 33 put o 10 1 34 end 35 ret enc1 view o w 36 end 37 38 fn gw_dec x ulong to void 39 b = new uchar 20 0 40 i = ulong 20 41 v = x 42 c = true 43 while c bound 20 44 i = sub i 1 45 put b i uchar add 48 rem v 10 46 v = div v 10 47 if eq v 0 48 c = false 49 end 50 end 51 k = write 1 b i sub 20 i 52 end 53 54 fn gw_sp to void 55 k = write 1 gwsp 0 1 56 end 57 58 fn gw_line op ulong f ulong st ulong g ulong w view ulong 4 to void 59 gw_dec op 60 gw_sp 61 gw_dec f 62 gw_sp 63 gw_dec st 64 gw_sp 65 gw_dec g 66 for k ulong 4 67 gw_sp 68 gw_dec get w k 69 end 70 k = write 1 gwnl 0 1 71 end 72 73 fn main to int 74 w = new ulong 4 0 75 for op ulong 64 76 for f ulong 3 77 r = gw_enc op f edit w 78 if ne r 0 79 gw_line op f 1 99 view w 80 else 81 gw_line op f 0 and shr get w 0 12 15 view w 82 end 83 end 84 end 85 ret 0 86 end