Current work on preprocessor implementation

Lots to refactor and test
This commit is contained in:
2023-11-05 16:21:09 +00:00
parent aadb21853a
commit 4ae6c05276
5 changed files with 116 additions and 89 deletions

View File

@@ -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;