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 value
  • CALL <arity> expects callable on stack
  • missing callable should be runtime error

Collections

  • MAKE_ARRAY n: pops n values, pushes one array
  • MAKE_MAP n: pops 2n entries and pairs key/value
  • GET_INDEX and SET_INDEX consume 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_SCOPE unchanged
  • 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
Use arrow keys or click edges to navigate. Press H to toggle help, F for fullscreen.