for one project in compilers, I have one problem in the parser, when I go to add a character to the character table, I always accept the same value in yylineno ...
I did this at the beginning:
%{ int yylex(void); int yyerror(char* yaccProvidedMessage); extern int yylineno;
and in grammar, when I want to add something to the character table:
i.e
lvalue: ID { printf("<-ID"); add_data_to_symbol_table((char*)($1),scope,yylineno); printf("lineNO:%d",yylineno); } ;
on output, when I give input with different lines it does not recognize a new line
if(x<=2) { if(t<1) { k=2; } }
string NO never changes, always has value 1 as value ...
any ideas?
Anastasis
source share