aboutsummaryrefslogtreecommitdiff
path: root/asm/parser.h
diff options
context:
space:
mode:
Diffstat (limited to 'asm/parser.h')
-rw-r--r--asm/parser.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/asm/parser.h b/asm/parser.h
index 0a65310..b0091d2 100644
--- a/asm/parser.h
+++ b/asm/parser.h
@@ -25,9 +25,10 @@ typedef enum
PERR_EXPECTED_UTYPE,
PERR_EXPECTED_TYPE,
PERR_EXPECTED_SYMBOL,
+ PERR_EXPECTED_LABEL,
PERR_EXPECTED_OPERAND,
- PERR_UNKNOWN_OPERATOR,
PERR_INVALID_RELATIVE_ADDRESS,
+ PERR_UNKNOWN_OPERATOR,
PERR_UNKNOWN_LABEL,
} perr_t;
@@ -37,16 +38,26 @@ typedef struct
{
inst_t instruction;
char *label;
- s_word relative_address;
+ s_word address;
enum PResult_Type
{
PRES_LABEL = 0,
PRES_LABEL_ADDRESS,
+ PRES_GLOBAL_LABEL,
PRES_RELATIVE_ADDRESS,
PRES_COMPLETE_RESULT,
} type;
} presult_t;
+typedef struct
+{
+ char *name;
+ size_t name_size;
+ word addr;
+} label_t;
+
+label_t search_labels(label_t *, size_t, char *);
+
perr_t parse_next(token_stream_t *, presult_t *);
perr_t process_presults(presult_t *, size_t, inst_t **, size_t *);
perr_t parse_stream(token_stream_t *, inst_t **, size_t *);