asm/parser supports all opcodes, introduced parse errors

Introduced some functions to parse differing types of opcodes.  Use
the same style of a.b.c... for namespacing or type specification for
certain opcodes.  Bit hacky and not tested, but does work.

Parse errors can be reported with an exact location using the token
column, line.
This commit is contained in:
2023-10-28 18:20:15 +01:00
parent 191fe5c6b8
commit eac8cbf1da
2 changed files with 217 additions and 87 deletions

View File

@@ -17,7 +17,20 @@
#include <vm/inst.h>
inst_t parse_next_inst(token_stream_t *);
inst_t *parse_stream(token_stream_t *, size_t *);
typedef enum
{
PERR_OK = 0,
PERR_INTEGER_OVERFLOW,
PERR_NOT_A_NUMBER,
PERR_EXPECTED_TYPE,
PERR_EXPECTED_SYMBOL,
PERR_EXPECTED_OPERAND,
PERR_UNKNOWN_OPERATOR,
} perr_t;
const char *perr_as_cstr(perr_t);
perr_t parse_next_inst(token_stream_t *, inst_t *);
perr_t parse_stream(token_stream_t *, inst_t **, size_t *);
#endif