help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help regarding Error Recovery in BISON.


From: Hans Aberg
Subject: Re: Help regarding Error Recovery in BISON.
Date: Fri, 20 Aug 2004 21:04:44 +0200

At 11:13 +0530 2004/08/20, Rachna Khanna wrote:
[Replies, cc help-bison.]
>Please help me regarding the error recovery in Bison.
>
>My project requires that the parser does not terminate on the first
>syntax error but recovers and continues parsing rest of the source file
>and reports any other syntax errors found.
>
>As far as I could gather knowledge on the error recovery mechanism is
>that only by writing production rules which specifies the errors can the
>parser made to be recovered and the parsing can be continued.

The Bison manual, chapter on error recovery, says:
  The choice of error rules in the grammar is a choice of strategies for
  error recovery.
So you write rules specifying how to recover from errors, not specifying
types of errors.

>But since
>the specifications in my project is vast, this would mean that many
>production rules will have to be specified which will make the parser
>complex.
>
>Is there any other general mechanism to carry out error recovery?

Whenever the Bison generated parser finds an error, it goes into error
recovery mode, and lops off the parser stack until it finds a state that is
error recoverable, as indicated in the grammar.

What other type of error recovery mechanism would you want.

>Also
>Could please suggest any detailed documentation which is available on
>the error handling and recovery mechanism of Bison.

The Bison manual, and the parser source code that Bison writes.

  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]