Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question on Part V in Let's Build a Compiler

0 views
Skip to first unread message

Steve Nicholson

unread,
Dec 14, 2009, 1:27:01 PM12/14/09
to
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

0 new messages