Hi!
I'm working on a mini compiler with flex and bison. The ".l" and ".y" files are generated successfully. However, when I try to compile the hole thing using the command "gcc -o comp comp.tab.c lex.yy.c ", I keep having this error :-(
In file included from comp.l:4:
comp.tab.h:56: error: expected identifier before ‘(’ token
It's supposed to be a syntax error but I honestly don't know where does it come from knowing that the file "comp.tab.h " is generated by bison...
*******comp.tab .h******
HELP please!
Thanks in advance!
I'm working on a mini compiler with flex and bison. The ".l" and ".y" files are generated successfully. However, when I try to compile the hole thing using the command "gcc -o comp comp.tab.c lex.yy.c ", I keep having this error :-(
In file included from comp.l:4:
comp.tab.h:56: error: expected identifier before ‘(’ token
It's supposed to be a syntax error but I honestly don't know where does it come from knowing that the file "comp.tab.h " is generated by bison...
*******comp.tab .h******
Code:
/* A Bison parser, made by GNU Bison 2.3. */
....
......
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
INTEGER_LITERAL = 258,
IDENTIFIER = 259,
MULT = 260,
INT = 261,
NEW = 262,
THIS = 263,
BOOLEAN = 264,
IF = 265,
WHILE = 266,
SYSTEM_OUT_PRINTLN = 267,
LENGTH = 268,
FALSE = 269,
TRUE = 270,
ELSE = 271,
EOF = 272,
AND = 273,
MINUS = 274,
INF = 275,
PLUS = 276
};
#endif
/* Tokens. */
#define INTEGER_LITERAL 258
#define IDENTIFIER 259
#define MULT 260
#define INT 261
#define NEW 262
#define THIS 263
#define BOOLEAN 264
#define IF 265
#define WHILE 266
#define SYSTEM_OUT_PRINTLN 267
#define LENGTH 268
#define FALSE 269
#define TRUE 270
#define ELSE 271
#define EOF 272 [B]// line 56[/B]
#define AND 273
#define MINUS 274
#define INF 275
#define PLUS 276
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef int YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE yylval;
Thanks in advance!
Comment