[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: About Bison Error Recovery
From: |
Hans Aberg |
Subject: |
Re: About Bison Error Recovery |
Date: |
Sun, 16 Nov 2003 12:21:32 +0100 |
At 16:20 +0800 2003/11/16, Michael wrote:
>use a1;
>use a2
>use a3;
...
>Apparently, I wish to report error at the phrase 'use a2', and go on parsing
...
>Then, what should I do with the grammar file, add 'error' bison-keywords to
>implement this simple error recovery?
All you can do is to follow the instructions for error recovery
implementation in the Bison manual, and experiment with that in a practical
manner. As Bison uses LALR(1), it may, when an error is detected, introduce
some extra reductions before error recovery is taking place. So if that is
unacceptable, one should use LR(1) instead (which Bison currently does not
support), but normally one does not need such an exact error recovery
scheme.
Hans Aberg