Re: Re: Is there an error correcting parser generator out there?

Boris Burshteyn <bburshte@us.oracle.com>
Tue, 4 Oct 1994 02:07:08 GMT

          From comp.compilers

Related articles
Is there an error correcting parser generator out there? hallmann@shiva.informatik.uni-dortmund.de (1994-09-26)
Re: Re: Is there an error correcting parser generator out there? rockwell@nova.umd.edu (Raul Deluth Miller) (1994-10-03)
Re: Re: Is there an error correcting parser generator out there? bburshte@us.oracle.com (Boris Burshteyn) (1994-10-04)
Re: Re: Is there an error correcting parser generator out there? rfg@netcom.com (1994-10-05)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Boris Burshteyn <bburshte@us.oracle.com>
Keywords: errors, parse, tools
Organization: Compilers Central
References: 94-09-142 94-10-015
Date: Tue, 4 Oct 1994 02:07:08 GMT

Terence Parr:
: 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 <rockwell@nova.umd.edu>:
>To generate the "nice" error message using yacc, the error recovery
>could be structured like this:
>[1] Build error recovery into your expression syntax.
>[2] Keep a data structure to record the details of the form of the
> error recovery.
>[3] 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
bburshte@us.oracle.com
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.