1234567891011121314151617181920212223242526272829303132333435363738394041 |
- #ifndef _SYMTABLE_H_
- #define _SYMTABLE_H_
- // Normal symbol table
- // find if identifier is visible (not out of scope)
- int lookup(char s[]);
- // find if identifier is in current scope only
- int lookup_scope(char s[]);
- int insert(char s[], int tok);
- int insert_data(char s[], int tok, int data);
- void increase_scope();
- void decrease_scope();
- int lastentry;
- // Current scope and its values
- int scope;
- struct entry {
- char *lexptr;
- int token;
- int data;
- int scope;
- };
- extern struct entry symtable[];
- // Struct symbol table
- int struct_lookup(char s[]);
- struct struct_entry {
- char *lexptr;
- struct entry *st;
- };
- extern struct struct_entry struct_symtable[];
- int struct_lookup(char s[]);
- int struct_insert(char s[], struct entry *st);
- int struct_lastentry;
- #endif
|