Build a quick draft of how the symbol value should be computed.
This commit is contained in:
@@ -13,16 +13,16 @@
|
||||
#define SYMBOLSTABLE_DEFAULT_CAPACITY 128
|
||||
|
||||
typedef struct __token_node {
|
||||
Token* Token;
|
||||
const Token* Token;
|
||||
struct __token_node* Left;
|
||||
struct __token_node* Right;
|
||||
} TokenNode;
|
||||
|
||||
typedef struct _symbol {
|
||||
char* Name;
|
||||
const char* Name;
|
||||
int Address;
|
||||
int Length;
|
||||
Token* Token;
|
||||
const Token* Token;
|
||||
TokenNode* ValueExpression;
|
||||
} Symbol;
|
||||
|
||||
@@ -33,12 +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);
|
||||
TokenNode* CreateTokenNode(const Token* token);
|
||||
int TryGetSymbol(const char* name, const SymbolTable* table, Symbol** outSymbol);
|
||||
Symbol* AddSymbolToTable(const 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);
|
||||
int SymbolResolved(const Symbol* symbol);
|
||||
int TryGetSymbolValue(const Symbol* symbol, const SymbolTable* table, unsigned short* value);
|
||||
|
||||
#endif
|
||||
+1
-1
@@ -50,7 +50,7 @@ typedef struct __token {
|
||||
Registers Register;
|
||||
Mnemonic Mnemonic;
|
||||
Directive Directive;
|
||||
int Number;
|
||||
unsigned short Number;
|
||||
} Value;
|
||||
|
||||
struct __token* Prev;
|
||||
|
||||
Reference in New Issue
Block a user