4 ['] 0BRANCH , \ compile 0BRANCH
5 HERE \ save location of the offset on the stack
6 0 , \ compile a dummy offset
11 HERE SWAP - \ calculate the offset from the address saved on the stack
12 SWAP ! \ store the offset in the back-filled location
16 ['] BRANCH , \ definite branch to just over the false-part
17 HERE \ save location of the offset on the stack
18 0 , \ compile a dummy offset
19 SWAP \ now back-fill the original (IF) offset
20 DUP \ same as for THEN word above
26 HERE \ save location on the stack
30 ['] 0BRANCH , \ compile 0BRANCH
31 HERE - \ calculate the offset from the address saved on the stack
32 , \ compile the offset here
36 ['] BRANCH , \ compile BRANCH
37 HERE - \ calculate the offset back
38 , \ compile the offset here
42 ['] 0BRANCH , \ compile 0BRANCH
43 HERE \ save location of the offset2 on the stack
44 0 , \ compile a dummy offset2
48 ['] BRANCH , \ compile BRANCH
49 SWAP \ get the original offset (from BEGIN)
50 HERE - , \ and compile it after BRANCH
52 HERE SWAP - \ calculate the offset2
53 SWAP ! \ and back-fill it in the original location
57 ['] NOT , \ compile NOT (to reverse the test)
58 [COMPILE] IF \ continue by calling the normal IF
62 ['] LIT , -1 , [COMPILE] IF
64 ['] LIT , HERE 0 , ['] >R ,
69 ['] 2DUP , ['] - , [COMPILE] IF
71 ['] LIT , HERE 0 , ['] >R ,
81 ['] R> , ['] RDROP , ['] RDROP ,
82 ['] LIT , HERE 7 + , ['] DUP , ['] -ROT , ['] - , ['] SWAP , ['] ! ,
94 ['] DUP , \ Store copy of increment
96 ['] R> , ['] SWAP , ['] R> , ['] SWAP , ['] R> , ['] SWAP , ['] + , ['] 2DUP , ['] - ,
97 ['] SWAP , ['] >R , ['] SWAP , ['] >R , ['] SWAP , ['] >R ,
99 \ Condition differently depending on sign of increment
100 ['] SWAP , ['] 0>= , [COMPILE] IF
106 \ Branch back to begining of loop kernel
107 ['] 0BRANCH , HERE - ,
110 ['] RDROP , ['] RDROP , ['] RDROP ,
112 \ Record address of loop end for any LEAVEs to use
116 ['] 2DROP , \ Clean up if loop was entirely skipped (?DO)
126 \ CASE ------------------------------------------------------------------------
129 0 \ push 0 to mark the bottom of the stack
133 ['] OVER , \ compile OVER
135 [COMPILE] IF \ compile IF
136 ['] DROP , \ compile DROP
140 [COMPILE] ELSE \ ENDOF is the same as ELSE
144 ['] DROP , \ compile DROP
146 \ keep compiling THEN until we get to our zero marker