Error:
Code:
mini-algol-60.y:31: error: conflicting types for 'YYSTYPE'
y.tab.h:6: error: previous declaration of 'YYSTYPE' was here
mini-algol-60.y:122: error: conflicting types for 'yylval'
y.tab.h:7: error: previous declaration of 'yylval' was here
mini-algol-60.y:122: error: conflicting types for 'yylval'
y.tab.h:7: error: previous declaration of 'yylval' was here
make: *** [algol.o] Error 1
y.tab.h
Code:
typedef union
#ifdef __cplusplus
YYSTYPE
#endif
{ int i; tree p; } YYSTYPE;
extern YYSTYPE yylval;
mini-algol-60.y line 122
Code:
{ $$ = buildIntTree( IntConst, $1 ); }
$$ is of type tree.
Relevant structures used.
Code:
typedef struct tree_node
{
int kind, value;
struct tree_node *first, *second, *third, *next;
} node;
typedef node* tree;
tree buildIntTree (int kind, int val)
{
tree p = (tree)malloc(sizeof (node));
p->kind = kind;
p->value = val;
p->first = p->second = p->third = NULL;
p->next = NULL;
return p;
}