I have the following definition in my lex file:
L [a-zA-Z_]
A [a-zA-Z_0-9]
%%
{L}{A}* { yylval.id = yytext; return IDENTIFIER; }
And I do the following in my YACC file:
primary_expression
: IDENTIFIER { puts("IDENTIFIER: "); printf("%s", $1); }
My source code (the one I'm analyzing) has the following assignment:
ab= 10;
For some reason, that printf("%s", $1);
part is printing ab=
and not only ab
.
I'm pretty sure that's the section that is printing ab=
because when I delete the printf("%s", $1);
the identifier is not printed at all.
I really ran out of ideas. What am I doing wrong?
Let me know if I can be more clear.