Added a SymbolTable object (untested at the moment) and redefined the Symbol object. I think when a Symbol is made only the size of it should matter to the code that will assemble the final binary.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
#ifndef SYMBOLSTABLE_H
|
||||
#define SYMBOLSTABLE_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define SYMBOLSTABLE_DEFAULT_CAPACITY 128
|
||||
|
||||
typedef struct {
|
||||
void* Value;
|
||||
char* Name;
|
||||
int Length;
|
||||
} Symbol;
|
||||
|
||||
typedef struct {
|
||||
Symbol** Symbols;
|
||||
int Size;
|
||||
int Capacity;
|
||||
} SymbolTable;
|
||||
|
||||
SymbolTable* CreateSymbolTable(void);
|
||||
Symbol* TryGetSymbol(char* name, SymbolTable* table);
|
||||
Symbol* AddSymbolToTable(char* name, void* value, int length, SymbolTable* table);
|
||||
void FreeSymbolTable(SymbolTable* table);
|
||||
void FreeSymbol(Symbol* symbol);
|
||||
|
||||
#endif
|
||||
@@ -6,8 +6,6 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define REGISTEROFFSET 29
|
||||
|
||||
typedef enum {
|
||||
PLUS,
|
||||
MINUS,
|
||||
|
||||
Reference in New Issue
Block a user