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
omega-mv / tools / exp445 / arms / common.md
| 1 | You write a small program for the Omega machine. The task says which function to write: its name, |
| 2 | its parameter types and its return type. You may add helper functions before it. |
| 3 | |
| 4 | Values and rules (the same whatever form you write the program in): |
| 5 | |
| 6 | - Types: bool, u8, u16, u32, u64 (unsigned), i8, i16, i32, i64 (signed, two's complement). |
| 7 | - No implicit conversions: the two operands of an arithmetic, bitwise or comparison operation have |
| 8 | the same type (a shift amount may be any integer type). Convert explicitly. |
| 9 | - Unsigned arithmetic wraps modulo 2^width. |
| 10 | - Signed +, -, *, negation and << must give a representable result, otherwise the run stops with |
| 11 | trap 1 (overflow). |
| 12 | - Division truncates toward zero; remainder has the sign of the dividend. A divisor of 0 stops the |
| 13 | run with trap 2 (division by zero). Signed MIN / -1 is trap 1. |
| 14 | - An array index out of bounds is trap 3. A loop that runs past its bound is trap 4. |
| 15 | - A conversion to a type that cannot hold the value is trap 5 (conversion out of range). |
| 16 | - A shift amount outside 0..width-1 is trap 7. |
| 17 | - A trap ends the whole run; it is the function's outcome. Only trap where the task asks for one. |
| 18 | |
| 19 | Answer with exactly one fenced code block (three backticks) that holds the complete program and |
| 20 | nothing else. Text outside the block is ignored. |