v3 Bytecode
Why this step matters
- bytecode now models closures and mutable containers, not just numbers
- runtime relies on strict op contract, not ad-hoc behavior
Closure flow
- function declarations become function objects
MAKE_CLOSURE <id>pushes callable valueCALL <arity>expects callable on stack- missing callable should be runtime error
Collections
MAKE_ARRAY n: popsnvalues, pushes one arrayMAKE_MAP n: pops2nentries and pairs key/valueGET_INDEXandSET_INDEXconsume deterministic operand order
Stack discipline
- every op has a fixed operand count contract
- container ops included in the same discipline as arithmetic ops
- explicit traces are essential for debugging
Control flow
JUMP,JUMP_IF_FALSE,ENTER_SCOPE,EXIT_SCOPEunchanged- now operands may be callables/collections, so scope errors are visible faster
Error surface
- non-closure call
- bad index access
- type mismatches on container operators
- arity mismatch where analyzable
Checks to verify
- map/array literal construction order
- closure object creation before invocation
- scope stack behavior around function values
1 / 1