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/seed/qualification/om2/sec/s3s4/inline-order-plain.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 / seed / qualification / om2 / sec / s3s4 / inline-order-plain.om` 65 lines ยท 1953 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note TWIN of inline-order.om with every inline removed (contract section 4 lines 96-97): OM-2 3 note unit, same expected stdout and exit per selector. 4 note Contract section 4 lines 93-98 (inline) and 102-104 (folding): arguments are evaluated left to 5 note right before the body, exactly as for a call; traps, their order and codes are unchanged; removing 6 note inline changes nothing (twin inline-order-plain.om). One stdin byte selects a case: 7 note A f (mk 10 1) (mk 3 2): markers 1 then 2, then 11/3 = 3 exit 0 8 note B f (div 1 0) (add `2147483647` 1): first argument traps 2 exit 102 9 note C f (add `2147483647` 1) (div 1 0): first argument traps 1 exit 101 10 note D f `2147483647` 0: body add traps 1 before body div traps 2 exit 101 (constant args: no fold) 11 note E f 5 0: body div by 0 traps 2 exit 102 (constant args: no fold) 12 note F f (mk 1 1) (div 1 0): marker 1 printed, then trap 2 exit 102 13 note G f (div 1 0) (mk 1 2): trap 2 before the marker exit 102 14 note H g -5, g 7: early ret inside an inlined body: 0 then 14 exit 0 15 note I g (mk 7 3): an argument used twice in the body is evaluated once: marker 3, then 14 16 note Expected stdout: oracle/s3s4/exp/inline-order-*.out (python3, oracle/s3s4/oracle.py). 17 om2 18 fn f a int b int to int 19 x = add a 1 20 ret div x b 21 end 22 fn g a int to int 23 if lt a 0 24 ret 0 25 end 26 ret mul a 2 27 end 28 fn mk v int t ulong to int 29 pu t 30 ret v 31 end 32 fn main to int 33 s = new uchar 1 0 34 r = read 0 s 0 1 35 k = get s 0 36 if eq k 65 37 pu ulong f mk 10 1 mk 3 2 38 end 39 if eq k 66 40 pu ulong f div int 1 0 add int `2147483647` 1 41 end 42 if eq k 67 43 pu ulong f add int `2147483647` 1 div int 1 0 44 end 45 if eq k 68 46 pu ulong f `2147483647` 0 47 end 48 if eq k 69 49 pu ulong f 5 0 50 end 51 if eq k 70 52 pu ulong f mk 1 1 div int 1 0 53 end 54 if eq k 71 55 pu ulong f div int 1 0 mk 1 2 56 end 57 if eq k 72 58 pu ulong g -5 59 pu ulong g 7 60 end 61 if eq k 73 62 pu ulong g mk 7 3 63 end 64 ret 0 65 end