From 4ae6c052764767f8281576a4ed938e1d6cf7c688 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Sun, 5 Nov 2023 16:21:09 +0000 Subject: Current work on preprocessor implementation Lots to refactor and test --- asm/parser.h | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'asm/parser.h') diff --git a/asm/parser.h b/asm/parser.h index 7aea7a2..46f8bc8 100644 --- a/asm/parser.h +++ b/asm/parser.h @@ -34,10 +34,16 @@ typedef enum const char *perr_as_cstr(perr_t); +// TODO: Refactor parser.c typedef struct { inst_t instruction; - char *label; + darr_t instructions; + struct PLabel + { + char *name; + size_t size; + } label; s_word address; enum PResult_Type { @@ -45,10 +51,20 @@ typedef struct PRES_LABEL_ADDRESS, PRES_GLOBAL_LABEL, PRES_RELATIVE_ADDRESS, + PRES_PP_CONST, PRES_COMPLETE_RESULT, } type; } presult_t; +// TODO: Implement these +presult_t presult_label(const char *, size_t, s_word); +presult_t presult_instruction(inst_t); +presult_t presult_instructions(size_t); +presult_t presult_addr(s_word); +presult_t pres_pp_const(const char *, s_word, size_t); +// TODO: Refactor parser.c to use this instead +void presult_free(presult_t); + typedef struct { char *name; -- cgit v1.2.3-13-gbd6f