help-bison
[Top][All Lists]
Advanced

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

Re: How can I check which rule I am in when an error occurs?


From: Hans Aberg
Subject: Re: How can I check which rule I am in when an error occurs?
Date: Fri, 14 Mar 2003 20:21:43 +0100

At 10:42 -0800 2003/03/14, Nupur Bhattacharyya wrote:
>I am using bison-1.28. Trying to detect which rule it is trying to
>match when I get an unexpected end of file. Is there a way to
>find out? I have YYDEBUG on and YYERROR_VERBOSE on but the error
>string in yyerror does not say more than parse error.

You probably have misunderstood how the LR parser algorithms work: Each
state corresponds to a set of rules, each with a dot in it telling how far
the parsing has proceeded, plus some context strings telling when
reductions are legal. So you need to figure out which state is present by
making a debugging output, and the check the state you find against the
description in the .output file that Bison can produce.

  Hans Aberg






reply via email to

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