v3 Bytecode Format (BC2)

  • Explain the BC1-to-BC2 call representation change.
  • Reconstruct closure creation before a callable-value CALL.
  • Test format fidelity separately from semantic bytecode validity.
1 / 6

Readiness

  • Trace v3 stack operations and function IDs.
  • Encode/decode BC1 sections and quoted strings.
2 / 6

Worked reconstruction

A complete callable-value example is:

BC2
FUNC 0 difference a b
LOAD a
LOAD b
SUB
RETURN
END
MAIN
MAKE_CLOSURE 0
PUSH_NUM 9
PUSH_NUM 2
CALL 2
END

MAKE_CLOSURE puts a callee below the two arguments. CALL 2 pops both arguments and that callee, then returns one value. Omitting MAKE_CLOSURE may still produce structurally parseable text, but the resulting program has no callable operand. A decoder is not automatically a stack verifier.

3 / 6

Diagnose before implementing

A BC1 migration replaces the line CALL difference 2 with CALL 2 but changes nothing else in Main. Why can Decode succeed while execution fails?

4 / 6

Independent transfer

Author two functions with IDs 3 and 1 in that order and Main creating closure 1. Predict which function executes after a round trip. Then add a comment before a jump and explain why the target number does not change.

5 / 6

Carry forward

Carry a standalone BC2 artifact into the v3 integration gate. It must execute without AST, name-analysis scopes, or in-memory closure instances from compilation.

6 / 6
←/→ or click edges to navigate · ? help · N notes · F fullscreen