18#define SYMBOL_TABLE_DEFAULT_LENGTH 1024
88#define GST_FIND(symbol_name) find_symbol_table_entry(D_GLOBAL_SYMBOL_TABLE, symbol_name)
89#define STS_FIND(symbol_name) find_symbol_table_stack_entry(D_SYMBOL_TABLE_STACK, symbol_name)
90#define STS_INSERT(symbol_name, type) \
91 add_symbol_table_entry(D_SYMBOL_TABLE_STACK->top, symbol_name, type)
92#define GST_INSERT(symbol_name, type) \
93 add_symbol_table_entry(D_GLOBAL_SYMBOL_TABLE, symbol_name, type)
Definitions for identifiers.
#define MAX_IDENTIFIER_LENGTH
Definition: identifier.h:12
Function headers for LLVM-IR emission.
Value returned by ast_to_llvm.
Definition: llvm.h:56
Struct holding data about a symbol.
Definition: symbol_table.h:23
unsigned long int bucket_index
Definition: symbol_table.h:29
char symbol_name[MAX_IDENTIFIER_LENGTH+1]
Definition: symbol_table.h:25
Type type
Definition: symbol_table.h:31
unsigned int chain_index
Definition: symbol_table.h:37
LLVMValue latest_llvmvalue
Definition: symbol_table.h:33
unsigned int length
Definition: symbol_table.h:27
struct SymbolTableEntry * next
Definition: symbol_table.h:35
Stack of Symbol Tables used for scoping.
Definition: symbol_table.h:61
SymbolTable * top
Definition: symbol_table.h:63
unsigned long long int length
Definition: symbol_table.h:62
Holds data for symbols within a scope.
Definition: symbol_table.h:43
unsigned long int total_buckets
Definition: symbol_table.h:49
unsigned long int length
Definition: symbol_table.h:45
struct SymbolTable * prev
Definition: symbol_table.h:53
SymbolTableEntry ** buckets
Definition: symbol_table.h:51
struct SymbolTable * next
Definition: symbol_table.h:55
unsigned long int capacity
Definition: symbol_table.h:47
Container for type data.
Definition: type.h:18
SymbolTableEntry * find_symbol_table_stack_entry(SymbolTableStack *table, char *symbol_name)
Find the entry of a symbol in the provided Symbol Table Stack if it exists, working from the top of t...
Definition: symbol_table.c:184
struct SymbolTable SymbolTable
Holds data for symbols within a scope.
struct SymbolTableStack SymbolTableStack
Stack of Symbol Tables used for scoping.
SymbolTableEntry * new_symbol_table_entry(char *symbol_name)
Get pointer to new Symbol Table Entry.
Definition: symbol_table.c:204
SymbolTable * peek_symbol_table(SymbolTableStack *stack)
Get pointer of the top Symbol Table from Symbol Table Stack.
Definition: symbol_table.c:114
void free_symbol_table_stack(SymbolTableStack *stack)
Free all memory in a Symbol Table Stack.
Definition: symbol_table.c:44
SymbolTable * new_symbol_table(void)
Get pointer to empty Symbol Table with length SYMBOL_TABLE_DEFAULT_LENGTH.
Definition: symbol_table.c:124
struct SymbolTableEntry SymbolTableEntry
Struct holding data about a symbol.
SymbolTableStack * new_symbol_table_stack(void)
Create a new Symbol Table Stack.
Definition: symbol_table.c:21
SymbolTableEntry * find_symbol_table_entry(SymbolTable *table, char *symbol_name)
Find the entry of a symbol in the provided Symbol Table if it exists.
Definition: symbol_table.c:166
SymbolTable * new_symbol_table_with_length(int length)
Get pointer to empty Symbol Table with a custom length.
Definition: symbol_table.c:134
SymbolTableStack * new_nonempty_symbol_table_stack(void)
Create a new Symbol Table Stack with one empty Symbol Table at the bottom.
Definition: symbol_table.c:34
SymbolTableEntry * add_symbol_table_entry(SymbolTable *table, char *symbol_name, Type type)
Hash symbol_name with hash function FNV-1 and put it into the chained Symbol Table.
Definition: symbol_table.c:224
void resize_symbol_table(SymbolTable *table)
Double the size of a Symbol Table's buckets array.
Definition: symbol_table.c:150
void push_existing_symbol_table(SymbolTableStack *stack, SymbolTable *new_table)
Push existing Symbol Table onto Symbol Table Stack.
Definition: symbol_table.c:67
void push_symbol_table(SymbolTableStack *stack)
Push new empty Symbol Table onto Symbol Table Stack.
Definition: symbol_table.c:56
void pop_and_free_symbol_table(SymbolTableStack *stack)
Remove Symbol Table from Symbol Table Stack and free its memory.
Definition: symbol_table.c:99
SymbolTable * pop_symbol_table(SymbolTableStack *stack)
Remove Symbol Table from Symbol Table Stack and return its pointer.
Definition: symbol_table.c:86
Function headers and defines for.