2. Compilation Model
A program is compiled as a whole. Every module is parsed, resolved and type-checked before any code runs, and @comptime values are computed at build time (§14).
Exposed execution modes#
The compiled program runs in one of two ways:
- on the Vader virtual machine, with
vader runandvader test; - as a native binary, through generated C and the system C compiler, with
vader build.
A WebAssembly target is planned (§17). The command line is described in docs/TOOLING.md.
Run-time checks#
The program stops, in every build mode, when:
- an array index is out of bounds;
- an integer division or remainder has a zero divisor;
- a conversion into a range type, an enum or
chargets a value outside the target type (Hour(x),E(x),char(x)).
INT_MIN / -1 gives INT_MIN. A float division follows IEEE 754 and can give inf or nan.
An integer +, -, * or unary - that overflows also stops the program, except in a release build, where it wraps (§4 Integer overflow).
There is no null check at run time: narrowing settles nullability at compile time.