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/ce-view-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 / ce-view-plain.om` 70 lines ยท 1997 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note TWIN of ce-view.om with every unroll and inline removed (section 4 lines 91, 97): OM-2 unit, 3 note same expectations per selector. 4 note Contract section 4 lines 105-108 and section 6 line 170, errata E2: every index into an UNSIZED view 5 note keeps its run-time check (trap 3), also when it is a constant after unrolling or inlining. b holds 6 note 1 10 100 ... 10^7; the callee sees a part of b (or the 4-element a4 = b[0..4), E2) and reads one 7 note element past its length, which in b is a defined neighbour: a compiler that drops the check prints 8 note it and exits 0 instead of trapping. One stdin byte selects: 9 note A sumv part b 0 4 (unrolled 5 reads): 1 11 111 1111, trap 3 exit 103 10 note B sumv a4 (sized array to view ulong *, E2): 1 11 111 1111, trap 3 exit 103 11 note C sumi part b 0 4 (sumv inlined): 1 11 111 1111, trap 3 exit 103 12 note D getc part b 0 4 (constant get v 6, no unroll): trap 3 exit 103 13 note E sumv part b 0 5 (in range): 1 11 111 1111 11111, then 11111 exit 0 14 note F sumv part b 3 4: 1000 11000 111000 `1111000`, trap 3 exit 103 15 note Twin ce-view-plain.om (unroll and inline removed) has the same expectations; OM-1 approximation 16 note ce-view-om1.om uses sized views. Expected: oracle/s3s4/exp/ce-view-*.out (python3). 17 om2 18 fn sumv v view ulong * to ulong 19 s = ulong 0 20 for i ulong 5 21 s = add s get v i 22 pu s 23 end 24 ret s 25 end 26 fn sumi v view ulong * to ulong 27 s = ulong 0 28 for i ulong 5 29 s = add s get v i 30 pu s 31 end 32 ret s 33 end 34 fn getc v view ulong * to ulong 35 ret get v 6 36 end 37 fn main to int 38 sb = new uchar 1 0 39 r = read 0 sb 0 1 40 k = get sb 0 41 b = new ulong 8 0 42 a4 = new ulong 4 0 43 p = ulong 1 44 for j ulong 8 45 put b j p 46 p = mul p 10 47 end 48 for j ulong 4 49 put a4 j get b j 50 end 51 if eq k 65 52 pu sumv part b 0 4 53 end 54 if eq k 66 55 pu sumv a4 56 end 57 if eq k 67 58 pu sumi part b 0 4 59 end 60 if eq k 68 61 pu getc part b 0 4 62 end 63 if eq k 69 64 pu sumv part b 0 5 65 end 66 if eq k 70 67 pu sumv part b 3 4 68 end 69 ret 0 70 end