symtable.h 765 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #ifndef _SYMTABLE_H_
  2. #define _SYMTABLE_H_
  3. // Normal symbol table
  4. // find if identifier is visible (not out of scope)
  5. int lookup(char s[]);
  6. // find if identifier is in current scope only
  7. int lookup_scope(char s[]);
  8. int insert(char s[], int tok);
  9. int insert_data(char s[], int tok, int data);
  10. void increase_scope();
  11. void decrease_scope();
  12. int lastentry;
  13. // Current scope and its values
  14. int scope;
  15. struct entry {
  16. char *lexptr;
  17. int token;
  18. int data;
  19. int scope;
  20. };
  21. extern struct entry symtable[];
  22. // Struct symbol table
  23. int struct_lookup(char s[]);
  24. struct struct_entry {
  25. char *lexptr;
  26. struct entry *st;
  27. };
  28. extern struct struct_entry struct_symtable[];
  29. int struct_lookup(char s[]);
  30. int struct_insert(char s[], struct entry *st);
  31. int struct_lastentry;
  32. #endif