|Is there an error correcting parser generator out there? email@example.com (1994-09-26)|
|Re: Re: Is there an error correcting parser generator out there? firstname.lastname@example.org (Raul Deluth Miller) (1994-10-03)|
|Re: Re: Is there an error correcting parser generator out there? email@example.com (Boris Burshteyn) (1994-10-04)|
|Re: Re: Is there an error correcting parser generator out there? firstname.lastname@example.org (1994-10-05)|
|From:||Boris Burshteyn <email@example.com>|
|Keywords:||errors, parse, tools|
|Date:||Tue, 4 Oct 1994 02:07:08 GMT|
: Let's consider a simple example. Assuming an input of
: if 3+* then ...
: for some rule:
: stat: IF expr THEN stat | ... ;
: we would like to see a nice error message like:
: file(line): error at "*": bad conditional of IF
: I argue that, while an automatic mechanism might be able to recover
: from this error, the error reporting facility could only generate
: something like
: file(line): error at "*" in expression
Raul Deluth Miller <firstname.lastname@example.org>:
>To generate the "nice" error message using yacc, the error recovery
>could be structured like this:
> Build error recovery into your expression syntax.
> Keep a data structure to record the details of the form of the
> error recovery.
> Defer reporting of error recovery to the statement level.
>Basically, at each significant production, begin by checking for
>errors which would have occurred during the text which lead to
>recognition of that production.
>Then again, perhaps the use of programmer defined data structures
>implies that this is "outside the scope of yacc"?
Since I have written a LR1 parser-generator (MUSKOX), I had to implement
an error recovery mechanism (which is placing error recovery tokens in the
user's syntax rules (similar to how YACC does it), and to provide some
user-controlled flags and callbacks). Interesting, that when the generated
parser parses a token flow in real time, a useful strategy is just to
ignore the noise and wait for a valid input for some time...
Anyway, I think most existing LR and LL generators provide some reasonable
mechanism for error recovery: ultimatly, arguments against either
approaches would leave the technical grounds. At the same time, the
'recovery' and the 'meaningful' error message are such only from the point
of view of the parser, not what the writer of the program might expect.
Regards, Boris Burshteyn
Return to the
Search the comp.compilers archives again.