Skip to main content

Module disasm

Module disasm 

Source
Expand description

Bytecode disassembler — readable text for the Studio debug drawer and any future largo --disasm. Pure, headless, no VM state. Bytecode disassembler — renders a CompiledProgram’s Op stream as readable text for the debugger (status line, bytecode tape) and any future largo --disasm. Common ops get a clean infix form (constants resolved, registers as R{n}, jump targets inline); the long tail falls back to the Op Debug form, so a newly added op is never a panic — just a plainer line.

Structs§

DisasmLine
One disassembled instruction.
OpIo
The registers an op reads (its sources) and the one it writes (its destination). Drives the debugger’s datapath animation — which register cells light up, flow into the engine, and receive the result — and the plain-English narration. Empty for the long-tail ops (no animation/narration), which fall back to the disassembly text.

Functions§

disassemble
Disassemble every instruction in prog.code (Main first, then the function bodies, which share the one code vector).
format_constant
The constant at idx, formatted for narration (e.g. 6, "hi", nothing).
format_op
Render one instruction. Registers print as R{n}; constants and global names are resolved against prog.
op_io
Compute the OpIo of a bytecode op.
op_targets
Absolute control-transfer targets of an op (for tape arrows / reachability).