home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.compilers      Compiler construction, theory, etc. (Mod      2,753 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 1,775 of 2,753   
   Steve Nicholson to All   
   Question on Part V in Let's Build a Comp   
   14 Dec 09 10:27:01   
   
   From: steve@steveandmimi.com   
      
   I'm working through Let's Build a Compiler (http://compilers.iecc.com/crenshaw/   
   ) and I've run into a problem. The definition of Block after the first   
   iteration of DoIf is:   
      
   procedure Block;   
   begin   
       while not(Look in ['e']) do begin   
          case Look of   
           'i': DoIf;   
           'o': Other;   
          end;   
       end;   
   end;   
      
   This seems to go into an infinite loop if Look is anything other than   
   'e', 'i', or 'o'.   
      
   The definition after DoWhile is introduced works correctly:   
      
   procedure Block;   
   begin   
       while not(Look in ['e', 'l']) do begin   
          case Look of   
           'i': DoIf;   
           'w': DoWhile;   
           else Other;   
          end;   
       end;   
   end;   
      
   Should the 'o:' case in the first version actually be 'else'?   
      
   -Steve   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca