help-bison
[Top][All Lists]
Advanced

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

Utterly confused at the Error recovery


From: Adam Smalin
Subject: Utterly confused at the Error recovery
Date: Sun, 13 Feb 2011 11:49:13 -0500

How does the error recovery work? like, i'll give an example of what i want
to do and what i got.

My input file is
---
codehere
Msg before the error
var1 = "sz"blah
Msg after the error
cout << "text"
--

as you know, blah should not be there. It should end at "sz" or have a +
between blah and sz. Now my rule looks like

funcBodyLoop2:
    | funcBodyLoop2 funcBody
    | funcBodyLoop2 error aEOS

What i am expecting is if funcBody gets an error anywhere at all it will use
the rule funcBodyLoop2 error aEOS. However this is NOT THE CASE. Why? The
code completely stops because for testing i made it the only error rule. If
i have a rule in classBody it will use that. Then for fun i tried `| error
aEOS` in funcBodyLoop2 and that rule was used!!! WTF!!!! My thoughts are why
is that ever use when it didnt use the other error rule? obviously
funcBodyLoop2 could reduce once without error (due to a blank rule). Also
the error occurs in the middle of the function body so multiple
funcBodyLoop2 have be reduced already. so wtf?

Its really annoying me and now frustrating me because i tried so many things
for over 5 hours and had no success. I did many google searches and found
absolutely no help (ibm has terrible grammer, its created by someone who
loops on the right side!)

Can anyone give me a good and simple explainable of how this really works?

Right now i think of error as a regular token, except it matches all of the
invalid tokens (or at least up to a limit) and reduces as the rule its in
(funcBodyLoop2 in this case). But, it doesnt appear to be that way if
`funcBodyLoop2: funcBodyLoop2 error aEOS` doesnt work on this relatively
simple file.


reply via email to

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