When you declare that expression
has type i
(%type<i> expression
), you're telling bison that wherever you've put an expression, the stack value should be the .i
variant. So in all of the expression
productions, $$
already represents the .i
union member; if you write an explicit .db
, then you end up generating yylval.i.db
. But yylval.i
is an int, which is not a strut or a union and therefore cannot have any members.
I strongly suspect that you intended the type of expression
to be db
, but whatever it is, you don't have to (and in fact cannot) explicitly specify the union member in your action.