www.pudn.com > lab3.rar > lab3.h


/* 
 * file : lab3.h 
 *---------------------------------- 
 * headfile for lab3.l & lab3.y 
 */ 
#ifndef LAB3_H_ 
#define LAB3_H_ 
 
#include  
#include  
 
#define HASHTABLESIZE 1511 
#define BUCKETSIZE    211 
#define SYMBOLSIZE    100 
#define FUNCTIONSIZE  1009 
#define BUFFERSIZE    100 
#define BUFFINCREMENT 50 
 
typedef struct { 
    char *name; 
    int  scope; 
    int  type; 
}symbol; 
 
typedef struct { 
    int type;      /* char type=CHAR char* type=CHAR+100 ... */ 
    int value; 
    char *string; 
    symbol *symadd; 
}expr; 
 
struct id_entry { 
    char *id; 
    struct id_entry *next; 
}; 
 
struct sym_entry { 
    symbol sym; 
    struct sym_entry *next;     
}; 
 
struct table { 
    int level; 
    struct table *previous; 
    struct sym_entry *buckets[BUCKETSIZE]; 
}; 
 
struct fun { 
    char *funame; 
    int retype; 
    int count; 
    int *type; 
    struct fun *next; 
}; 
 
struct buffer { 
    int *temp; 
    int size; 
}; 
 
FILE *yyin; 
int lineno;    /* number of line */ 
int debug;     /* debug flag */ 
int right;     /* error flag */ 
struct id_entry *id_hash_table[HASHTABLESIZE]; 
struct table *symboltable[SYMBOLSIZE]; 
struct table *globaltable; 
int tablelen;           /* symboltable length */ 
int level;              /* nested depth */ 
struct fun *funtable[FUNCTIONSIZE]; 
struct buffer argtemp;  /* argument list buffer */ 
int typecount; 
struct buffer arg_in;   /* argument check buffer */ 
int typecheck; 
 
char *InsertID(char *name); 
char *InsertFun(char *name, int returntype); 
int LookUpFun(char *name); 
struct table *MakeTable(struct table *previous, int level); 
symbol *InsertSym(char *name, struct table *tp); 
symbol *LookUp(char *name, struct table *tp); 
 
#endif /* LAB3_H_ */