1
0
Fork 0
undar-lang-register/src/tools/assembler/assembler.h

60 lines
854 B
C

#ifndef UNDAR_IR_ASSEMBLER_H
#define UNDAR_IR_ASSEMBLER_H
#include "../../vm/common.h"
#include "../../vm/opcodes.h"
#include "lexer.h"
typedef enum { GLOBAL, LOCAL } ScopeType;
typedef enum {
VOID,
BOOL,
I8,
I16,
I32,
U8,
U16,
U32,
F8,
F16,
F32,
STR,
PLEX,
ARRAY,
FUNCTION
} SymbolType;
typedef struct names_tab_s NamesTable;
typedef struct value_type_s ValueType;
typedef struct symbol_s Symbol;
typedef struct symbol_tab_s SymbolTable;
struct names_tab_s {
char **names;
u32 count;
u32 capacity;
};
struct value_type_s {
SymbolType type;
u32 name;
u32 size;
};
struct symbol_s {
u32 name;
ValueType type;
ScopeType scope;
u32 ref; // address if global, register if local
};
struct symbol_tab_s {
Symbol *symbols;
u32 count;
u32 capacity;
};
void assemble(VM *vm, char *source);
#endif