[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
request for member in something not a structure or union (yacc parse err
From: |
Krishna Murthy Gudipati |
Subject: |
request for member in something not a structure or union (yacc parse error) |
Date: |
Wed, 16 Jul 2003 18:04:19 +0530 |
Dear Friends,
I have small problem using the %union in the parser. I am working on Solaris
8 and using lex and yacc provided as system utilities on Solaris OS.
I have defined a structure in an header file as :
typedef struct port{
char* portName;
MODE portMode;
TYPE portType;
struct port* next;
} PORT;
And this header file is included in the yacc parser. I am trying to define
the %union as follows :
%union {
char* keyValue;
PORT* portStmnt;
}
When i am comiling it is giving parse error in the y.tab.h header file :
###########################################
krishna-1% make
yacc -d -v -t vhdl.yacc
lex vhdl.lex
gcc -w -c -g y.tab.c
gcc -w -c -g lex.yy.c
In file included from lex.yy.c:87:
y.tab.h:8: error: parse error before "PORT"
y.tab.h:10: error: parse error before "yylval"
vhdl.lex: In function `yylex':
vhdl.lex:127: error: request for member `keyValue' in something not a
structure or union
vhdl.lex:128: error: request for member `keyValue' in something not a
structure or union
vhdl.lex:129: error: request for member `keyValue' in something not a
structure or union
vhdl.lex:131: error: request for member `keyValue' in something not a
structure or union
*** Error code 1
make: Fatal error: Command failed for target `lex.yy.o'
krishna-1%
#########################################
The gcc is not able to recognise the PORT structure which i have defined in
the header file. At the same time when i am declaring a variable using the
structure PORT in the section before %union in the parser then gcc has no
complaint i.e
%{
PORT* portStatement; // gcc has no problem with this
.....
%}
%union {
char* keyValue;
PORT* portStmnt; // gcc says parse error in the y.tab.h
}
Please help me in resolving this issue.
Thanks and Regards,
Krishna
- request for member in something not a structure or union (yacc parse error),
Krishna Murthy Gudipati <=