123456789101112131415161718192021222324252627282930313233343536 |
- #ifndef _SYMTABLE_H_
- #define _SYMTABLE_H_
- /* entry in the symbol table and its data
- */
- struct entry {
- char *lexptr;
- int token;
- int value;
- };
- // init
- int symtable_init();
- // lookup and insert functions
- int symtable_lookup(char s[]);
- int symtable_insert(char s[], int tok);
- /* scope functions
- * push: create a new (empty) symtable as a child of the current one
- * pop : remove current symtable (including clean) and assign parent as the current one
- */
- void symtable_push();
- void symtable_pop ();
- // responsible for cleaning memory
- void symtable_clean();
- // mostly for debugging, just print the table
- void symtable_print();
- // from an index to the symtable, get the entry
- struct entry *symtable_entryat(int index);
- #endif
|