yacc doesn't seem to like it when my tokens are of the type I defined.
At the top of my grammar file ( .y ) in the %{ ... %} block, I include a header file that defines the following structure:
typedef struct _spim_register { spim_register_type type; int number; } spim_register;
Before my list of rules, I have:
%token AREG ... %union { struct _spim_register reg; } ... %type <reg> register AREG
I get
error: field 'reg is of incomplete type
in the line in the %union clause when trying to compile the code generated by the bison. In my statement, %union , trying to declare reg by writing spim_register reg; , an error message is displayed:
unknown type name 'spim_register'
There seems to be something special in %union { ... } because I can use the data structures from my header file in the actions for the rules.
Arick
source share