summaryrefslogtreecommitdiff
path: root/parser.y
diff options
context:
space:
mode:
authorBobby Bingham <koorogi@koorogi.info>2017-01-18 19:20:20 -0600
committerBobby Bingham <koorogi@koorogi.info>2017-01-18 19:20:20 -0600
commit1e0d0202e614f398f491624c84ae9a8309fa2f96 (patch)
tree1000df0a8eb39453ac48a14809dd250230f67e6c /parser.y
parent2e0de3cc53d031ac2fa48eddc9a472b0e4c34a45 (diff)
nqasm: allow "." to refer to current pc in immediate operand
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y3
1 files changed, 3 insertions, 0 deletions
diff --git a/parser.y b/parser.y
index e698e47..2ec2264 100644
--- a/parser.y
+++ b/parser.y
@@ -15,6 +15,7 @@ void yyerror(const char *msg)
#define MKARGS(...) (struct arguments) { { __VA_ARGS__ } }
#define MKARGVALUE(v) (struct argument) { .type = ARG_INTEGER, .value = (v) }
#define MKARGLABEL(l) (struct argument) { .type = ARG_LABEL, .label = (l) }
+#define MKARGTYPE(t) (struct argument) { .type = (t) }
%}
@@ -80,6 +81,7 @@ void yyerror(const char *msg)
%token T_COMMA ","
%token T_COLON ":"
+%token T_DOT "."
%token T_DEREF "@"
%type <inst> inst
@@ -178,6 +180,7 @@ reg: T_LABEL {
expr:
intlit { $$ = MKARGVALUE($1); }
| T_LABEL { $$ = MKARGLABEL($1); }
+ | "." { $$ = MKARGTYPE(ARG_PC); }
;
intlit: T_INT