parser_.h 1.09 KB
Newer Older
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
1
2
3
4
5
6
7
8
9
10
11
/*************************************************************************
  FILE:  parser.h
  DESCR: parser defs. for BDD calculator
  AUTH:  Jorn Lind
  DATE:  (C) may 1999
*************************************************************************/

#ifndef _PARSER_H
#define _PARSER_H

#include <stdio.h>
12
#include "bddx.h"
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

#define MAXIDLEN 32  /* Max. number of allowed characters in an identifier */

struct token         /* BISON token data */
{
   char id[MAXIDLEN+1];
   char *str;
   int ival;
   bdd *bval;
};

#define YYSTYPE token
#define YY_SKIP_YYWRAP
#define YY_NO_UNPUT
#define yywrap() (1)

extern YYSTYPE yylval;            /* Declare for flex user */
Alexandre Duret-Lutz's avatar
[buddy]    
Alexandre Duret-Lutz committed
30
extern void yyerror(const char *,...);  /* Declare for flex and bison */
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
31
32
33
34
35
36
extern FILE *yyin;
extern int yylex(void);           /* Declare for bison */
extern int yyparse(void);         /* Declare for bison user */
extern int linenum;               /* Declare for error handler */

   /* Use this instead of strdup() to avoid malloc() */
Alexandre Duret-Lutz's avatar
[buddy]    
Alexandre Duret-Lutz committed
37
inline char *sdup(const char *s)
Alexandre Duret-Lutz's avatar
Alexandre Duret-Lutz committed
38
39
40
41
42
43
44
{
   return strcpy(new char[strlen(s)+1], s);
}

#endif /* _PARSER_H */

/* EOF */