| Related articles |
|---|
| Question on Part V in Let's Build a Compiler steve@steveandmimi.com (Steve Nicholson) (2009-12-14) |
| From: | Steve Nicholson <steve@steveandmimi.com> |
| Newsgroups: | comp.compilers |
| Date: | Mon, 14 Dec 2009 10:27:01 -0800 |
| Organization: | Compilers Central |
| Keywords: | question |
| Posted-Date: | 14 Dec 2009 14:57:03 EST |
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
Return to the
comp.compilers page.
Search the
comp.compilers archives again.