Contents    Page-10    Prev    Next    Page+10    Index   

Looping Statements

Looping statements generate multiple statements in intermediate code, as shown in the following patterns. (Generate label numbers by j = labelnumber++;.)

for i := start to end do s

(PROGN (:= i start)
       (LABEL j)
       (IF (<= i end)
           (PROGN s
                  (:= i (+ 1 i))
                  (GOTO j) )))
while c do s

       (IF c (PROGN s (GOTO j))))

repeat statements until c

       (PROGN statements)
       (IF c (PROGN) (GOTO j)))
The empty (PROGN) acts as a no-op.