Control Flow

BEGIN
Interpretation: Interpretation semantics for this word are undefined.
Compilation: ( C: -- dest )
Put the next location for a transfer of control, dest, onto the control flow stack. Append the run-time semantics given below to the current definition.
Run-time: ( -- )
Continue execution.
DO
Interpretation: Interpretation semantics for this word are undefined.
Compilation: ( C: -- do-sys )
Place do-sys onto the control-flow stack. Append the run-time semantics given below to the current definition. The semantics are incomplete until resolved by a consumer of do-sys such as LOOP.
Run-time: ( n1|u1 n2|u2 -- ) ( R: -- loop-sys )
Set up loop control parameters with index n2|u2 and limit n1|u1. An ambiguous condition exists if n1|u1 and n2|u2 are not both the same type. Anything already on the return stack becomes unavailable until the loop-control parameters are discarded.
I
 
Interpretation: Interpretation semantics for this word are undefined.
Execution: ( -- n|u ) ( R: loop-sys -- loop-sys )
n|u is a copy of the current (innermost) loop index. An ambiguous condition exists if the loop control parameters are unavailable.
IF
 
Interpretation: Interpretation semantics for this word are undefined.
Compilation: ( C: -- orig )
Put the location of a new unresolved forward reference orig onto the control flow stack. Append the run-time semantics given below to the current definition. The semantics are incomplete until orig is resolved, e.g., by THEN or ELSE.
Run-time: ( x -- )
If all bits of x are zero, continue execution at the location specified by the resolution of orig.
J
Interpretation: Interpretation semantics for this word are undefined.
Execution: ( -- n|u ) ( R: loop-sys1 loop-sys2 -- loop-sys1 loop-sys2 )
n|u is a copy of the next-outer loop index. An ambiguous condition exists if the loop control parameters of the next-outer loop, loop-sys1, are unavailable.
+LOOP
plus-loop
Interpretation: Interpretation semantics for this word are undefined.
Compilation: ( C: do-sys -- )
Append the run-time semantics given below to the current definition. Resolve the destination of all unresolved occurrences of LEAVE between the location given by do-sys and the next location for a transfer of control, to execute the words following +LOOP.
Run-time: ( n -- ) ( R: loop-sys1 -- | loop-sys2 )
An ambiguous condition exists if the loop control parameters are unavailable. Add n to the loop index. If the loop index did not cross the boundary between the loop limit minus one and the loop limit, continue execution at the beginning of the loop. Otherwise, discard the current loop control parameters and continue execution immediately following the loop.
ELSE
Interpretation: Interpretation semantics for this word are undefined.
Compilation: ( C: orig1 -- orig2 )
Put the location of a new unresolved forward reference orig2 onto the control flow stack. Append the run-time semantics given below to the current definition. The semantics will be incomplete until orig2 is resolved (e.g., by THEN). Resolve the forward reference orig1 using the location following the appended run-time semantics.
Run-time: ( -- )
Continue execution at the location given by the resolution of orig2.
LEAVE
Interpretation:: Interpretation semantics for this word are undefined.
Execution:: ( -- ) ( R: loop-sys -- )
Discard the current loop control parameters. An ambiguous condition exists if they are unavailable. Continue execution immediately following the innermost syntactically enclosing DO
1. .. LOOP or DO ... +LOOP. LOOP
Interpretation:: Interpretation semantics for this word are undefined.
Compilation:: ( C: do-sys -- )
Append the run-time semantics given below to the current definition. Resolve the destination of all unresolved occurrences of LEAVE between the location given by do-sys and the next location for a transfer of control, to execute the words following the LOOP.
Run-time:: ( -- ) ( R: loop-sys1 -- | loop-sys2 )
An ambiguous condition exists if the loop control parameters are unavailable. Add one to the loop index. If the loop index is then equal to the loop limit, discard the loop parameters and continue execution immediately following the loop. Otherwise continue execution at the beginning of the loop.
UNLOOP
Interpretation: Interpretation semantics for this word are undefined.
Execution: ( -- ) ( R: loop-sys -- )
Discard the loop-control parameters for the current nesting level. An UNLOOP is required for each nesting level before the definition may be EXITed. An ambiguous condition exists if the loop-control parameters are unavailable.
REPEAT
Interpretation: Interpretation semantics for this word are undefined.
Compilation: ( C: orig dest -- )
Append the run-time semantics given below to the current definition, resolving the backward reference dest. Resolve the forward reference orig using the location following the appended run-time semantics.
Run-time: ( -- )
Continue execution at the location given by dest.
UNTIL
Interpretation: Interpretation semantics for this word are undefined.
Compilation: ( C: dest -- )
Append the run-time semantics given below to the current definition, resolving the backward reference dest.
Run-time: ( x -- )
If all bits of x are zero, continue execution at the location specified by dest.
WHILE
Interpretation: Interpretation semantics for this word are undefined.
Compilation: ( C: dest -- orig dest )
Put the location of a new unresolved forward reference orig onto the control flow stack, under the existing dest. Append the run-time semantics given below to the current definition. The semantics are incomplete until orig and dest are resolved (e.g., by REPEAT).
Run-time: ( x -- )
If all bits of x are zero, continue execution at the location specified by the resolution of orig.