Table of Contents

3.5.0 Instructions

An instruction is the unit the interpreter's program counter fetches. A procedure body has one instruction per executable StatementNode, plus the synthesized instructions that a block statement needs but has no source node for. Instructions are ordered in the order execution would normally reach them.

RD-VBAL §3.4.0 Statements catalogs the statement tree the parser produces. This section catalogs the flat, offset-addressable InstructionList that InstructionListLowering produces from that tree. Executing it is the role that RD-VBAL §2.3.1 Composition Root gives the evaluation engine: "sequentially evaluate each instruction in the frame."

Why a flat list

GoTo, GoSub, On…GoTo, On…GoSub and Resume can jump to any statement in the procedure. A recursive tree walk cannot express an arbitrary jump, which is why statements are lowered to a flat instruction list.

Expressions keep their tree shape, because expressions contain no jumps. Lowering therefore only flattens the statement tree; it never flattens the expression trees held in each statement's Inputs.


In this section

§ Title
3.5.1 InstructionList
3.5.2 Instruction
3.5.3 Lowering Block Statements
3.5.4 Execution
3.5.5 Placement and Licensing

⏮️ RD-VBAL §3.4.3 File Statements | ⏭️ RD-VBAL §3.5.1 InstructionList