aboutsummaryrefslogtreecommitdiff
path: root/asm/parser.h
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2023-11-05 16:21:09 +0000
committerAryadev Chavali <aryadev@aryadevchavali.com>2023-11-05 16:21:09 +0000
commit4ae6c052764767f8281576a4ed938e1d6cf7c688 (patch)
treef47a2b3557858065ce2d96d2d548e0b1216aad56 /asm/parser.h
parentaadb21853a0defc9aeac55ee2f4d582ba0c52cf4 (diff)
downloadovm-4ae6c052764767f8281576a4ed938e1d6cf7c688.tar.gz
ovm-4ae6c052764767f8281576a4ed938e1d6cf7c688.tar.bz2
ovm-4ae6c052764767f8281576a4ed938e1d6cf7c688.zip
Current work on preprocessor implementation
Lots to refactor and test
Diffstat (limited to 'asm/parser.h')
-rw-r--r--asm/parser.h18
1 files changed, 17 insertions, 1 deletions
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;