help-bison
[Top][All Lists]
Advanced

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

How do i print out my token and rule stack?


From: Adam Smalin
Subject: How do i print out my token and rule stack?
Date: Thu, 24 Feb 2011 03:34:22 -0500

When using -t in bison i get the "Ambiguity detected." printout below when i
hit a reduce/reduce ambiguity (this only happened when i messed around with
error handing, i normally dont have conflicts).

I have a syntax error and i DONT KNOW WHY. I get "funcBodyLoop2  b" multiple
times which leaves me to believe this rule is recurring and funcBody is
being evaluated. However this doesnt make sense because funcBody has no
problem with that line as i get no error on that line if the error on the
previous line is commented out. But then why or how is "funcBodyLoop2  b"
looping? What is it trying to do?

So i'd like to print out like the ambiguity detected printout when i get my
syntax error so i can understand whats going on. (The syntax error atm says
"syntax error line 75 col 27 word/token 'errHereOnPurpose'" in my yyerror
function)

funcBodyLoop2:
    | funcBodyLoop2 funcBody
    | error aEOS { doerror("funcBodyLoop2  b", YYRECOVERING()); yyclearin;
yyerrok; }


Ambiguity detected.
Option 1,
  funcBodyLoop2 -> <Rule 132, tokens 135 .. 142>
    funcBodyLoop2 -> <Rule 133, tokens 135 .. 135>
........
Option 2,
  funcBodyLoop2 -> <Rule 133, tokens 135 .. 142>
........


reply via email to

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