|Error recovery and LR(1)/LALR(1) heng@Ag.arizona.edu (Heng Yuan) (2002-06-17)|
|Re: Error recovery and LR(1)/LALR(1) email@example.com (Gordon V Cormack) (2002-06-20)|
|Re: Error recovery and LR(1)/LALR(1) firstname.lastname@example.org (2002-06-20)|
|Error recovery and LR(1)/LALR(1) email@example.com (Chris F Clark) (2002-06-20)|
|Re: Error recovery and LR(1)/LALR(1) firstname.lastname@example.org (=?Windows-1252?Q?S=F6nke_Kannapinn?=) (2002-06-28)|
|Date:||20 Jun 2002 21:45:46 -0400|
|Posted-Date:||20 Jun 2002 21:45:46 EDT|
On Mon, 17 Jun 2002 04:13:11 UTC, "Heng Yuan" <heng@Ag.arizona.edu>
> I am in the process of writing an LR(1)/LALR(1) parser generator called
> YooParse, which will be used with YooLex, a C++ lexer generator. While I
> successfully generated the LR(1)/LALR(1) DFA states, I encountered
> problems dealing with error states. This is a long post.
> Situation 1:
> For example, a DFA state contains the following LR(1) items
> A -> alpha X . , lookahead = 'a'
> B -> beta X . gamma , lookahead = 'b'
> My question is really what to do if the lookahead is neither 'a'
> or 'b'? Should A be reduced?
You have discovered an error! You need an error recovery mechanism
and error output at this point. Simply taking an arbitrary choice
will likely generate an explosion of follow on errors. There are
insertion/deletion/reset schemes for better error recovery.
Return to the
Search the comp.compilers archives again.