v3 Bytecode Format (BC2)
BC2 contract
BC2header requiredFUNC <id> <name> <params...>sectionsMAINsection required- each section ends with
END
Function identity
- function IDs are numeric handles
- IDs must be unique
- IDs are used by
MAKE_CLOSUREand linker offset rewriting
Instruction syntax
- mnemonic + optional immediates
- no separators beyond whitespace
- decode validates argument count/type by opcode
Validation discipline
- unknown opcode
- bad integer values
- mismatched
END - missing
MAIN - section order/structure errors
Why BC2
- stable human-readable artifact
- deterministic roundtrips
- decouples compiler and VM
Good checks
- deterministic encode/decode
- stable error messages
- explicit function metadata and init bytecode shape
1 / 1