help-bison
[Top][All Lists]
Advanced

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

RE: Query about error recovery in bison


From: Hans Aberg
Subject: RE: Query about error recovery in bison
Date: Fri, 27 Aug 2004 19:28:31 +0200

At 16:22 +0530 2004/08/27, Ranjeeta wrote:
>> I suggested you to change the assignment of the yyerrstatus
>> variable from 3 to 1; have you tried that?
>
>Yes I tried this. It is not working. It goes into infinite loop if use
>it with #define YYERROR_VERBOSE 1 . Even if I use it alone then no error
>is issued for invalid lines & parser terminates.

There are actually two lines one should change:
  if (yyerrstatus == 3)
and
  yyerrstatus = 3;
But this just says how many tokens that should be shifted before error
messages resume.

>alone then it works, but I am getting 2 errors for each invalid lines.
>If I remove the 2nd yyerror function call then it works. (please refer
>my mail dated 26/08/04 sub 'RE: Query about error recovery in bison')

OK. Now I see what you are complaining about. It looks like a bug in your
skeleton file: In Bison 1.35, the second yyerror has an "else" before it,
so that it will become excluded. You can just try to change it, or try the
skeleton file from Bison 1.35 (and invoke your own skeleton file using the
--skeleton option). (Bison 1.50 and later use another skeleton file format,
for use with M4.)

But you are your own in this experimenting, as these are old version. So I
suggest you to upgrade to at least Bison 1.75, as soon as possible. Your
problem is in fact a good motivation for keeping to the newer versions.

  Hans Aberg






reply via email to

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