|
From: | Andrei Harangus |
Subject: | Some problems in Bison |
Date: | Thu, 27 Mar 2003 07:15:50 +0200 |
Hy,
I am trying to make flex and bison communicate, and
I have defined something like:
...
%union{
char *lex;
double dval;
}
%token <lex> TYPE ID
%%
decl : TYPE ID ; {printf("%s
%s",$1,$2);}
%%
....
In flex I do the following:
....
int {yylval.lex = yytext; return
TYPE;}
[_a-zA-Z0-9][_a-zA-Z0-9]* {yylval.lex = yytext;
return ID}
...
And when running on something like
int c;
I get the result :
int c; c;
i.e. $1 is 'int c;' and $2 is 'c;'
Can anyone tell me how to make bison get the real
values (i.e. 'int' and 'c')?
Thakns!
|
[Prev in Thread] | Current Thread | [Next in Thread] |