JUMP_IF_ZERO_FLAG @if_instruction
JUMP @continue
@if_instruction
LOAD [#123] A
@continue
ADD A
Need to be careful with indentation - it could give the impression that:
IF_ZERO_FLAG
LOAD [#123] A
LOAD [#23] B
ADD A
Would execute both only when the condition is true. If indentation is ignored (as it currently is it will always execute the second LOAD).
A decision also needs to be made about whether a couple of extra instructions are added for the compiler to use to skip 1-n lines, or to have the compiler always just hard code the instruction to jump to based on the size of the block.
Also need to decide if this extends to else bocks. Something to replace:
JUMP_IF_ZERO_FLAG @if
JUMP @else
@if
LOAD [#123] A
JUMP @continue
@else
LOAD [#34] A
@continue
ADD A
e.g.
IF_ZERO_FLAG @if
LOAD [#123] A
ELSE
LOAD [#34] A
ADD A
Allow something like:
Which would replace:
Need to be careful with indentation - it could give the impression that:
Would execute both only when the condition is true. If indentation is ignored (as it currently is it will always execute the second LOAD).
A decision also needs to be made about whether a couple of extra instructions are added for the compiler to use to skip 1-n lines, or to have the compiler always just hard code the instruction to jump to based on the size of the block.
Also need to decide if this extends to else bocks. Something to replace:
e.g.
This is straying into compiler territory...