Misc
Builtins and compiler forms that don't belong to a single subsystem.
print
print(...) // variadic; any number of printable argumentsprint is variadic — it accepts any mix of printable values (integers, strings, booleans) and writes them in order, followed by a newline. It's the one variadic form in the language (a compiler special-cased feature, since Munos has no user-level varargs).
print("score: ", score, " lives: ", lives)Because there's no implicit number-to-string conversion, print is how you display a number next to text — don't try "score: " + score (that's a type error; + on strings needs string operands).
print is a development/diagnostic tool; output goes to the host's log.
Casts
i8(x) i16(x) i32(x)
u8(x) u16(x) u32(x)Convert between integer types. A cast takes exactly one integer argument; narrowing truncates. Required wherever types must match, since Munos never converts implicitly. See Types → Conversions.
var x = i32(read_u8(0x0086))Array & string forms
These compiler forms operate on arrays (and len also on strings). Full details on the Arrays page.
len(x) // current length (array or string) → i32
size(x) // capacity (array) → i32
push(arr, v) // append within capacity; traps when full
pop(arr) // remove & return last; traps when empty
copy(x) // independent duplicate (array or string; not structs)var a: i32[] = [1, 2, 3]
print(len(a)) // 3
var b = copy(a)
b[0] = 99 // a unchangedQuick index
| Form | Returns | Notes |
|---|---|---|
print(...) | — | variadic; trailing newline |
i8…u32``(x) | the target type | one integer arg; truncates |
len(x) | i32 | array or string |
size(x) | i32 | array capacity |
push(a, v) | — | traps at capacity |
pop(a) | element type | traps when empty |
copy(x) | type of x | arrays/strings only |