|
From: | Galini |
Subject: | request for member `nvval' in something not a structure or union |
Date: | Wed, 25 Dec 2002 04:15:12 +0200 |
Hello,
I am trying desperatly to compile my parser, however i can't
get rid of the :
request for member `nvval' in something not
a structure or union
error messages with all names of union type members
available...
I believe I know how to use the %union structure but still I
got no idea why I keep getting this error on every line I attempt to assign
value to a typed $$ or read from $n ...
Some code snippets from my files :
typedef struct NUMVAL { float val; int varType; }numVal; .
.
.
%union {
int ival; float fval; numVal nvval; char* sval; } %token TYPE_INT TYPE_REAL TYPE_BOOLEAN AND OR SEMI LPAREN RPAREN TRUE FALSE
REAL
%type <nvval> Num_Exp Bool_Exp _expression_ %token <sval> ID %token <nvval> INTEGER .
.
.
Bool_Exp :
TRUE { numVal* temp = (numVal*)malloc(sizeof(numVal)); temp->val = 1; temp->varType = 0; $$ = *temp;} | FALSE { numVal* temp = (numVal*)malloc(sizeof(numVal)); temp->val = 0; temp->varType = 0; $$ = *temp;} | LPAREN Bool_Exp RPAREN { $$ = $2; } ; .
.
.
And from the lexer file :
.
.
[a-z]([0-9]|[a-z])* {yylval.sval =
strdup(yytext);
return ID;} .
.
Anyone ????????
Thanx in advance .
|
[Prev in Thread] | Current Thread | [Next in Thread] |