|Re: error recovery firstname.lastname@example.org (1989-04-30)|
|Error recovery email@example.com (Cayot Robert-Olivier) (1997-03-21)|
|Re: Error recovery firstname.lastname@example.org (Gord Cormack) (1997-03-22)|
|Re: Error recovery P.Whillance@ncl.ac.uk (Peter Whillance) (1997-03-27)|
|Error Recovery email@example.com (1997-05-12)|
|Re: Error Recovery firstname.lastname@example.org (1997-05-25)|
|Re: Error Recovery email@example.com (Thomas W. Christopher) (1997-05-25)|
|Re: Error Recovery firstname.lastname@example.org (Mark Gregory) (1997-05-27)|
|Re: Error Recovery email@example.com (Michael Roach) (1997-05-31)|
|Date:||25 May 1997 13:40:19 -0400|
! The one thing we rarely get around here are questions concerning
!error recovery while parsing. What systems exist already for error
!recovery, and what form do they take? What would be the ideal and how
!can we implement them? I have very few ideas in this area and would be
!happy for any suggestions.
One of the fundamental requirements to perform any form of error
recovery is to atleast obtain the erroneous tokens while parsing. I
have been using PCYACC and PCLEX (from Abraxas Software) lately and
there is no direct way to obtain the erroneous tokens. I believe this
is true of lex and yacc in general.
Here is what I mean: Suppose I have a production to parse out valid
user names in a given environment, WORD being an alphabetical string
terminal containing the username.
UserName : '"' WORD '"'
valid($3) ? printf("%s valid", $3) : printf("%s unknown", $3);
| '" error '"'
printf("%s not a valid username format", $3);
what I would like to do in the 'error' production is to tell the user
what the error string was. However, the parser reduces the first
unknown token in the input stream to 'error', discards all the
following tokens until a " is seen in the input stream and reduces to
the error production. I have no way of retrieving the discarded
tokens. Wouldn't it be nice to store the discarded tokens in the
I guess one of the reasons why this is not being done by default is
because it precludes any custom error recovery that a user might
prefer. Maybe a command line option to the parser could choose between
the default and user defined error recovery.
Return to the
Search the comp.compilers archives again.