summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2025-07-20 02:19:57 -0400
committerIan Moffett <ian@osmora.org>2025-07-20 02:21:01 -0400
commita28b2df73300a6f6a6e7f107443c096b52b2b9e2 (patch)
treea177eb494c9c24e6d4f3cad0fc8bcc787d81aec8
parentcbfdaea7fb9aef02e43292fa0a317419e1d5df62 (diff)
usr: oasm: Add register token types
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--usr.bin/oasm/include/oasm/lex.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/usr.bin/oasm/include/oasm/lex.h b/usr.bin/oasm/include/oasm/lex.h
index 6688348..9e293e6 100644
--- a/usr.bin/oasm/include/oasm/lex.h
+++ b/usr.bin/oasm/include/oasm/lex.h
@@ -31,7 +31,8 @@
#define _OASM_LEX_H_
#include <stdint.h>
-#include <oasm/state.h>
+
+struct oasm_state;
#define __XN_REGS \
TT_X0, \
@@ -94,15 +95,16 @@ typedef enum {
TT_DIV, /* 'div' */
/* Register ops */
- TT_MOV,
- TT_INC,
- TT_DEC,
+ TT_MOV, /* 'mov' */
+ TT_INC, /* 'inc' */
+ TT_DEC, /* 'dec' */
+ TT_IMM, /* #<n> */
/* Register sets */
- __XN_REGS,
- __FN_REGS,
- __DN_REGS,
- __VN_REGS,
+ __XN_REGS, /* x0-x15 */
+ __FN_REGS, /* f0-f7 */
+ __DN_REGS, /* d0-d7 */
+ __VN_REGS, /* v0-v7 */
/* Symbols */
TT_COMMA, /* ',' */
@@ -110,6 +112,7 @@ typedef enum {
struct oasm_token {
tt_t type;
+ uint8_t is_reg : 1;
char *raw;
};