Redesigning the way the Symbol's represent string declaration (the .db msg 'Hello World' type of declarations).

This commit is contained in:
2022-10-06 21:33:29 -05:00
parent f38da9cc74
commit d3d2b06dbd
4 changed files with 101 additions and 12 deletions
+10 -2
View File
@@ -1,6 +1,7 @@
#ifndef SYMBOLSTABLE_H
#define SYMBOLSTABLE_H
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
@@ -13,13 +14,19 @@ typedef enum {
Address
} SymbolType;
typedef struct {
char* String;
uint8_t TerminatorByte;
int HasTerminatorByte;
} SymbolString;
typedef struct {
char* Name;
int Length;
int Resolved;
union {
char* Text;
SymbolString String;
int Number;
//Instruction Instruction;
} Value;
@@ -33,7 +40,8 @@ typedef struct {
SymbolTable* CreateSymbolTable(void);
Symbol* TryGetSymbol(char* name, SymbolTable* table);
Symbol* AddSymbolToTable(char* name, void* value, int length, SymbolTable* table);
Symbol* AddSymbolToTable(char* name, SymbolTable* table);
SymbolString* CreateSymbolString(char* text);
void FreeSymbolTable(SymbolTable* table);
void FreeSymbol(Symbol* symbol);