Started to work on setting up Symbol value resolution which will be based on an abstract syntax tree that can handle undefined values if unknown symbols are used in an expression.
This commit is contained in:
@@ -12,11 +12,18 @@
|
||||
|
||||
#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 {
|
||||
@@ -26,10 +33,12 @@ typedef struct {
|
||||
} 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
|
||||
Reference in New Issue
Block a user