I would like to understand why BISON is concatenating two tokens on the following rule
stmt:
declaration { ... }
| assignment
This flex action is incorrect:
yylval.id_v = yytext;
yytext
points into an internal work buffer. Its contents will change every time the scanner is called. So if you want to keep the string which makes up the token, you must copy the string into your own storage, for example using strdup
. (Don't forget to free the allocated storage when you are finished with it.)