1
0
Fork 0

WIP refactoring compiler to be less verbose

This commit is contained in:
zongor 2026-02-27 00:15:32 -08:00
parent 197b8ee0ef
commit 5df7e1a561
4 changed files with 592 additions and 730 deletions

View File

@ -91,14 +91,14 @@ ifeq ($(BUILD_MODE), release)
PLATFORM_SOURCE := $(ARCH_DIR)/main.c \ PLATFORM_SOURCE := $(ARCH_DIR)/main.c \
$(ARCH_DIR)/devices.c\ $(ARCH_DIR)/devices.c\
$(SRC_DIR)/tools/lexer.c \ $(SRC_DIR)/tools/lexer.c \
$(SRC_DIR)/tools/assembler/assembler.c $(SRC_DIR)/tools/assembler/assembler.c \
# $(SRC_DIR)/tools/compiler/compiler.c $(SRC_DIR)/tools/compiler/compiler.c
else else
PLATFORM_SOURCE := $(ARCH_DIR)/main.c \ PLATFORM_SOURCE := $(ARCH_DIR)/main.c \
$(ARCH_DIR)/devices.c \ $(ARCH_DIR)/devices.c \
$(SRC_DIR)/tools/lexer.c \ $(SRC_DIR)/tools/lexer.c \
$(SRC_DIR)/tools/assembler/assembler.c $(SRC_DIR)/tools/assembler/assembler.c \
# $(SRC_DIR)/tools/compiler/compiler.c $(SRC_DIR)/tools/compiler/compiler.c
endif endif
# --- OBJECT FILES --- # --- OBJECT FILES ---

View File

@ -1,4 +1,4 @@
//#include "../../tools/compiler/compiler.h" #include "../../tools/compiler/compiler.h"
#include "../../tools/assembler/assembler.h" #include "../../tools/assembler/assembler.h"
#include "../../vm/vm.h" #include "../../vm/vm.h"
#include "devices.h" #include "devices.h"

File diff suppressed because it is too large Load Diff

View File

@ -5,6 +5,14 @@
#include "../../vm/common.h" #include "../../vm/common.h"
#include "../../vm/opcodes.h" #include "../../vm/opcodes.h"
typedef struct op_def_s OpDef;
struct op_def_s {
i32 instruction_byte_size;
void (*parse_symbol)(VM *vm, ScopeTable *st, char *op_name);
void (*emit_symbol)(VM *vm, ScopeTable *st, char *op_name);
char *to_str;
};
bool compile(VM *vm, ScopeTable *st, char *source); bool compile(VM *vm, ScopeTable *st, char *source);
extern bool table_realloc(ScopeTable *table);/* implement this in arch/ not here */ extern bool table_realloc(ScopeTable *table);/* implement this in arch/ not here */