Updated the way symbols are represented and how they are marked as resolved.
This commit is contained in:
@@ -12,12 +12,23 @@
|
||||
|
||||
#define SYMBOLSTABLE_DEFAULT_CAPACITY 128
|
||||
|
||||
typedef struct {
|
||||
typedef enum {
|
||||
RefUnknown,
|
||||
RefLiteral,
|
||||
RefExpression,
|
||||
RefPointer
|
||||
} ReferenceType;
|
||||
|
||||
typedef struct _symbol {
|
||||
char* Name;
|
||||
int Address;
|
||||
int Resolved;
|
||||
int Length;
|
||||
Token* References;
|
||||
union {
|
||||
Token* Mnemonic;
|
||||
struct _symbol* Symbol;
|
||||
unsigned short Number;
|
||||
} Value;
|
||||
ReferenceType Type;
|
||||
} Symbol;
|
||||
|
||||
typedef struct {
|
||||
@@ -28,8 +39,9 @@ typedef struct {
|
||||
|
||||
SymbolTable* CreateSymbolTable(void);
|
||||
int TryGetSymbol(char* name, SymbolTable* table, Symbol** outSymbol);
|
||||
Symbol* AddSymbolToTable(char* name, int address, int resolved, SymbolTable* table);
|
||||
Symbol* AddSymbolToTable(char* name, int address, SymbolTable* table);
|
||||
void FreeSymbolTable(SymbolTable* table);
|
||||
void FreeSymbol(Symbol* symbol);
|
||||
int SymbolResolved(Symbol* symbol);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user