#ifndef SYMBOLSTABLE_H #define SYMBOLSTABLE_H #include #include #include #include #include #include #include "opcodes.h" #include "token.h" #define SYMBOLSTABLE_DEFAULT_CAPACITY 128 typedef struct __token_node { Token* Token; struct __token_node* Left; struct __token_node* Right; } TokenNode; typedef struct _symbol { char* Name; int Address; int Length; Token* Token; TokenNode* ValueExpression; } Symbol; typedef struct { Symbol** Symbols; int Size; int Capacity; } SymbolTable; SymbolTable* CreateSymbolTable(void); TokenNode* CreateTokenNode(Token* token); int TryGetSymbol(char* name, SymbolTable* table, Symbol** outSymbol); Symbol* AddSymbolToTable(char* name, int address, SymbolTable* table); void FreeSymbolTable(SymbolTable* table); void FreeSymbol(Symbol* symbol); int SymbolResolved(Symbol* symbol); int TryGetSymbolValue(const Symbol* symbol, const SymbolTable* table, unsigned short** value); #endif