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/tests/compiler/progs/arena_nested.osc # 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 / tests / compiler / progs / arena_nested.osc` 31 lines ยท 851 bytes Raw Blame History 1 // entry: nested sibling 2 // OSC-2 arenas: nested arenas; the inner arena is destroyed first, then the 3 // outer one. Sibling arenas reuse the runtime slot of a destroyed arena. 4 // expect-run: nested 3 -> 15 5 // expect-run: sibling 2 -> 9 6 fn nested(k: u16) -> u16 { 7 let mut s: u16 = 0; 8 arena outer bound 4 { 9 let a: own [u16; 2] in outer = alloc(k); 10 arena inner bound 4 { 11 let b: own [u16; 4] in inner = alloc(k * 2); 12 let c: own [u16; 2] in outer = alloc(3); 13 s = a[0] + b[3] + c[1] * 2; 14 } 15 s = s + 0; 16 } 17 return s; 18 } 19 20 fn sibling(k: u8) -> u8 { 21 let mut s: u8 = 0; 22 arena r1 bound 2 { 23 let a: own [u8; 2] in r1 = alloc(k); 24 s = a[1]; 25 } 26 arena r2 bound 2 { 27 let b: own [u8; 2] in r2 = alloc(k + 5); 28 s = s + b[0]; 29 } 30 return s; 31 }