[Top][All Lists]

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

few questions

From: Aleksey Perfilov
Subject: few questions
Date: Tue, 27 Jul 2004 11:47:35 -0700

Hi, guys.
I need help with improving my syntax error messages.
Right now I just have standard bison error handling where it looks at possible tokens and
says <token> expected.
Few quetions, if you don't have time to read all, please answer just on one or two of them.

question 1:
I am not exactly clear on contents of yytable, what does it mean "portions for different
uses" ? What do those portions contain and in what format?
for example if I have
what do last two expressions mean?
question 2:
if I put an error token in a rule that doesn't have a closing token like this
stmnts:  /* empty string */
        | stmnts '\n'
        | stmnts exp '\n'
        | error
is error token going to match all of the remaining output if syntax error occurs?

question 2:
what if I have a mid rule where I decide that something's wrong and want to ignore the whole
expr : part1 { some checks here } part2 part3 part4 part5
How can I go about it?

question 3:
If I get an error in lexer, for example closing comment w/o opening comment, how can I get
the parser to ignore the token or maybe a serie of tokens?
For example if I have a construct IF outside of a function in C++ I need to ignore the whole
thing and continue parsing next function.
Is it just a matter of smart error token usage?

question 4:
In Bison code there is YYFAIL macro that goes to yyerrlab:
Is it the default action when an error is encountered?

question 5:
For example if I have a piece of program like this:
when parser reads "b" it errors, I print "missing semicolon" but then I want to continue
parsing. How do I put back "b" so that b=2; is parsed successfully.

thanks in advance

reply via email to

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