1/************************************************************************* 2 FILE: parser.h 3 DESCR: parser defs. for BDD calculator 4 AUTH: Jorn Lind 5 DATE: (C) may 1999 6*************************************************************************/ 7 8#ifndef _PARSER_H 9#define _PARSER_H 10 11#include <stdio.h> 12#include "bdd.h" 13 14#define MAXIDLEN 32 /* Max. number of allowed characters in an identifier */ 15 16struct token /* BISON token data */ 17{ 18 char id[MAXIDLEN+1]; 19 char *str; 20 int ival; 21 bdd *bval; 22}; 23 24#define YYSTYPE token 25#define YY_SKIP_YYWRAP 26#define YY_NO_UNPUT 27#define yywrap() (1) 28 29extern YYSTYPE yylval; /* Declare for flex user */ 30extern void yyerror(char *,...); /* Declare for flex and bison */ 31extern FILE *yyin; 32extern int yylex(void); /* Declare for bison */ 33extern int yyparse(void); /* Declare for bison user */ 34extern int linenum; /* Declare for error handler */ 35 36 /* Use this instead of strdup() to avoid malloc() */ 37inline char *sdup(const char *s) 38{ 39 return strcpy(new char[strlen(s)+1], s); 40} 41 42#endif /* _PARSER_H */ 43 44/* EOF */ 45