Files
assm-test/includes/symbols_table.h
T

33 lines
690 B
C

#ifndef SYMBOLSTABLE_H
#define SYMBOLSTABLE_H
#include <stdint.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include "opcodes.h"
#define SYMBOLSTABLE_DEFAULT_CAPACITY 128
typedef struct {
char* Name;
int Address;
int Resolved;
int Length;
} Symbol;
typedef struct {
Symbol** Symbols;
int Size;
int Capacity;
} SymbolTable;
SymbolTable* CreateSymbolTable(void);
int TryGetSymbol(char* name, SymbolTable* table, Symbol** outSymbol);
Symbol* AddSymbolToTable(char* name, int address, int resolved, SymbolTable* table);
void FreeSymbolTable(SymbolTable* table);
void FreeSymbol(Symbol* symbol);
#endif