I have a problem in my lexer and in my parser.
Firstly, in my lexer, I have a line like this:
"if" beginScope(stOTHER); return IF;
And in my parser:
stmt: IF '(' exp ')' stmts
...
stmts: stmt
| '{' stmt_list '}'
| '{' '}'
In this code:
if(sth) {
dosth;
}
if(other) {
doothersth;
}
beginScope will be called twice because (I think) Bison doesn't know where the statement ends if, so when it finds a token if, it takes it as the end if, and read it a second time to run another statement if...
Please help me...
source
share