Dear bison users,

I'm having trouble figuring out how to use merge with a glr-parser. I found this example on the net:

        

stmt : expr ';'  %merge <stmtMerge>
    | decl      %merge <stmtMerge>
    ;
and define the |stmtMerge| function as:

        

static YYSTYPE
stmtMerge (YYSTYPE x0, YYSTYPE x1)
{
 printf ("<OR> ");
 return "";
}
with an accompanying forward declaration in the C declarations at the beginning of the file:

        

%{
 #define YYSTYPE char const *
 static YYSTYPE stmtMerge (YYSTYPE x0, YYSTYPE x1);
%}



I have a union:

%union {
   Node* node;
   bool boolean;
   int integer;
}

I would like to use Node* as YYSTYPE in my merge-function, but to do this I need a forward declaration of YYSTYPE. But when I do this, a have a redefinition of YYSTYPE, so the parser won't compile.
Am I doing something wrong, or is this impossible to do?

Timo


_______________________________________________
help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to