|
我在用YACC写编译器的时候,遇到一个很奇怪的问题,以下是我的declare.h文件
# include <stdio.h>
/* gate types */
# define INPT 1
# define BUFF 2
# define NOT 3
# define AND 4
# define NAND 5
# define OR 6
# define NOR 7
# define FAN 8
# define MAXGATES 20000
/* structure for gates */
typedef struct {
unsigned gtype :4; /* gate type */
unsigned name :15;
unsigned source;
unsigned short fanin; /* fanin count */
unsigned short fanout; /* fanout count */
struct lnode *outlist; /* fanout list */
struct lnode *inlist; /* input list */
} GNODE;
/* structure for ordinary lists */
typedef struct lnode {
unsigned nnum : 24;
unsigned timeframe : 8;
struct lnode *nextnode;
} LNODE;
GNODE gate[MAXGATES]; /* the circuit graph */
unsigned gatenum, /* number of gates */
然后在和parse.y一起用make编译的时候,GCC老是给我如下提示:
error: 'LNODE' redeclared as different kind of symbol
LNODE是我在parse.y第一部分定义里出现的,第一部分如下:
%{
#include "declare.h"
LNODE *node;
int origin, record;
struct {
char *symbol;
int val;
} symtab1[] = { "PI", INPT,
"buff", BUFF,
"FAN", FAN,
"not", NOT,
"and", AND,
"or", OR,
"nor" NOR,
"nand", NAND,
0, 0
};
%}
%token COMMENT GTYPE FANOUT NUM NAME
%token FANIN INPUT FAULT
%%
它的意思好象是我的LNODE有重复定义了,但是我实在看不出哪里还有定义过啊,请各位帮忙找一下原因吧,谢谢拉~~~~~ |
|