  | 
                             S   while E do S 1 
 | 
                           
                          
                             S.begin = newlabel
  | 
                           
                          
                             E.true = newlabel   | 
                           
                          
                             E.false = S.next
  | 
                           
                          
                             S 1 .next = S.begin
  | 
                           
                          
                             S.ocde = gen(S.begin ':') ||   | 
                           
                          
                            
                              
                                 E.code ||
 
                                 gen(E.true ':') || 
 
                                 S 1 .code ||
 
                                 gen(goto S.begin)
 
                               
                              | 
                           
                                                 
                       For while-do 
                      
S -> while E do S1
 
                       S.begin = newlabel
 
                      E.true = newlabel 
                      
E.false = S.next
 
                      S1.next = S.begin 
                      
S.code = gen(S.begin ':') || E.code || gen(E.true ':') || S1.code || gen(goto S.begin)
                        In case of while-do statement a new label S.begin is created and associated with the first instruction of the code for E, so that control can be transferred back to E after the execution of S1. E.false is set to S.next, so that control moves out of the code for S in case E is false. Since S1.next is set to S.begin, jumps from the code for S1 can go directly to S.begin.
  |