Error recovery and LR(1)/LALR(1)

"Heng Yuan" <heng@Ag.arizona.edu>
17 Jun 2002 00:13:11 -0400

          From comp.compilers

Related articles
Error recovery and LR(1)/LALR(1) heng@Ag.arizona.edu (Heng Yuan) (2002-06-17)
Re: Error recovery and LR(1)/LALR(1) gvcormac@uwaterloo.ca (Gordon V Cormack) (2002-06-20)
Re: Error recovery and LR(1)/LALR(1) kgw-news@stiscan.com (2002-06-20)
Error recovery and LR(1)/LALR(1) cfc@world.std.com (Chris F Clark) (2002-06-20)
Re: Error recovery and LR(1)/LALR(1) soenke.kannapinn@wincor-nixdorf.com (=?Windows-1252?Q?S=F6nke_Kannapinn?=) (2002-06-28)
| List of all articles for this month |
From: "Heng Yuan" <heng@Ag.arizona.edu>
Newsgroups: comp.compilers
Date: 17 Jun 2002 00:13:11 -0400
Organization: The University of Arizona
Keywords: parse, LALR, question
Posted-Date: 17 Jun 2002 00:13:11 EDT

Hi,


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?


Situation 2:
For example, a DFA state contains the following LR(1) items
A -> alpha X . , lookahead = 'a'
B -> beta X . , lookahead = 'b'
What if the lookahead is neither 'a' nor 'b'? Do I assume default
transitions on A since the rule for A preceeds B?


My concern is the loss of chance of early recovery.


Thanks


Heng Yuan
heng@ag.arizona.edu


Post a followup to this message

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