Re: Parser Error Detection and Recovery

djones@megatest.com (Dave Jones)
25 Mar 91 23:28:02 GMT

          From comp.compilers

Related articles
Parser Error Detection and Recovery georgev@fiu.edu (1991-03-21)
Parser error detection and recovery snyder@CHILDE.CS.NYU.EDU (1991-03-22)
Re: Parser Error Detection and Recovery arnold@audiofax.com (1991-03-22)
Re: Parser Error Detection and Recovery rekers@cwi.nl (1991-03-25)
Re: Parser Error Detection and Recovery djones@megatest.com (1991-03-25)
Re: Parser Error Detection and Recovery scott@bbxsda.UUCP (1991-03-28)
Re: Parser Error Detection and Recovery megatest!djones@decwrl.dec.com (1991-04-01)
Parser error detection and recovery julia@cs.warwick.ac.uk (Julia Dain) (1991-04-10)
| List of all articles for this month |
Newsgroups: comp.compilers
From: djones@megatest.com (Dave Jones)
Keywords: yacc, errors, debug
Organization: Megatest Corporation, San Jose, Ca
References: <9103211951.AA01615@fiu.edu>
Date: 25 Mar 91 23:28:02 GMT

>From article <9103211951.AA01615@fiu.edu>, by georgev@fiu.edu (Vincent George):


> [There has been considerable discussion of this in the past. Yacc's
> default reductions make error recovery hard, since by the time it realizes
> there's an error it may have lost much of the context that one would want
> to use to recover from the error. -John]


The default reductions have never given me any trouble. As you will
recall, they do make it very tedious to list all the legal tokens when an
error occurs.


However, the original yacc has a bug related to default-reductions which
makes proper error-recovery impossible: It creates states with default
reductions and a shift-action on "error". The bug is a typo. To fix it,
find the following line in file y3.c




if(temp1[1] > 0) lastred = 0;


Change it to read


if(temp1[2] > 0) lastred = 0;
[Well, what do you know. -John]
--


Post a followup to this message

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