Brings over the duskscript VM and compiler from dusk-vm: the runtime (core/vm) lives under src/dusk/script, gated by DUSK_SCRIPT and wired into the engine lifecycle with print()/consolePrint() routed to the console; the standalone duskscriptcc compiler stays a lean host tool (linux/knulli only). Collapses int/fixed/bignum into a single float-backed SCRIPT_VALUE_NUMBER throughout the lexer, compiler, bytecode format and VM, removing the old int16-rollover fast paths and the type-conversion builtins they needed. Fixes a real big-endian bug in the bytecode's 32-bit number reader (found while adding GameCube/Wii endian support via util/endian.h) and converts src/dusk/script and duskscriptcc to dusk's memory/string/assert utilities, which surfaced two more latent bugs: a conservative GC stack scan reading its own local variable's address, and an uninitialized path buffer in scriptReadScript when the caller path has no directory component. Co-Authored-By: Claude Sonnet 5 <[email protected]>
21 lines
396 B
Plaintext
21 lines
396 B
Plaintext
consolePrint(tostr(3 + 2));
|
|
consolePrint(tostr(1.5 + 2.25));
|
|
consolePrint(tostr(10 / 4));
|
|
consolePrint(tostr(3 < 2));
|
|
|
|
var i = 0;
|
|
var sum = 0;
|
|
while(i < 5) {
|
|
sum = sum + i;
|
|
i = i + 1;
|
|
}
|
|
consolePrint(tostr(sum));
|
|
|
|
var arr = [10, 20, 30];
|
|
consolePrint(tostr(arr[1]));
|
|
|
|
consolePrint(tostr(5 & 3));
|
|
consolePrint(tostr(1 << 4));
|
|
consolePrint(tostr(floor(3.7)));
|
|
consolePrint(tostr(tonum("3.5")));
|