|
From: | Davide Rizzo |
Subject: | &union and overlapping declarations |
Date: | Mon, 20 Jan 2003 15:55:40 +0100 |
I'm using Bison 1.24 together with
Flex 2.5
I would like to define two different
semantic types for my tokens and rules, so I specified the
following:
%union {
char* str; int integer; } %token
<str> IDENTIFIER WEEK HOUR DAY
MONTH YEAR
%token
<integer> DAY_OF_WEEK MONTH_NAME DIGIT
%type
<integer> input phrase note date_specification date
date_stmt date_interval
%type
<integer> time time_stmt time_specification
time_interval
...etc...
in the declaration section. After
having assigned each token and rule a semantic type, I arranged Flex to return
the right values, eg:
[[:alpha:]]+ {
yylval = yytext; return(IDENTIFIER); } [0-9]+ { yylval = atoi(yytext); return(DIGIT); } Bison and Flex correctly generate the
whole, but when I try to compile the code (using Dev-C++ 4.9 gcc compiler) I get
some strange errors:
I guess there's something wrong with
type definition/redefinition, but I cannot understand what I must change. Can
you help me?
Thanks so much in advance,
regards
Davide Rizzo
|
[Prev in Thread] | Current Thread | [Next in Thread] |