Fixed compiler.sx: hex literals → decimal (Python parser compat), variadic subtraction → nested binary ops. Verified compilation of: (+ 1 2) → CONST 1; CONST 2; CALL_PRIM "+" 2; RETURN (if (> x 0) ...) → JMP_FALSE with correct offset patching (let ((x 1)) ...) → LOCAL_SET/GET with slot indices (no hash) (define f (fn)) → CLOSURE with nested bytecode + pool The compiler resolves all variable references at compile time: - let bindings → LOCAL_GET/SET with numeric slot - fn params → LOCAL_GET with numeric slot - globals/primitives → GLOBAL_GET / CALL_PRIM - tail calls → TAIL_CALL (not yet wired to VM) Next: wire compiled code into OCaml VM and benchmark vs CEK. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5.7 KiB
5.7 KiB