parse.y merged.
[toypasc.git] / symbol_table.h
blob82bd07fd43e55181c99da7aafcc3bb227cc8ec32
1 #ifndef SYMBOL_TABLE_H
2 #define SYMBOL_TABLE_H
4 #include "base.h"
6 #define symbol_table_init() sym_table = NULL
7 #define symbol_add(table, name) table = symbol_insert(table, name)
9 typedef struct _symbol {
10 char *name;
11 Type type;
12 Value value;
13 //Scope
14 struct _symbol *next;
15 } Symbol;
17 static Symbol *sym_table;
19 Symbol *symbol_new(char const * name);
20 Symbol *symbol_insert(Symbol *table, char const *name);
21 Symbol *symbol_lookup(Symbol *table, char const *name);
22 //symbol_get_scope, parent_scope, etc....
24 void symbol_table_destroy(Symbol **table);
25 void symbol_table_dump(Symbol *table);
26 void symbol_print(Symbol *symbol);
28 #endif // SYMBOL_TABLE_H