From 1e0d0202e614f398f491624c84ae9a8309fa2f96 Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Wed, 18 Jan 2017 19:20:20 -0600 Subject: nqasm: allow "." to refer to current pc in immediate operand --- parser.y | 3 +++ 1 file changed, 3 insertions(+) (limited to 'parser.y') 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 @@ -178,6 +180,7 @@ reg: T_LABEL { expr: intlit { $$ = MKARGVALUE($1); } | T_LABEL { $$ = MKARGLABEL($1); } + | "." { $$ = MKARGTYPE(ARG_PC); } ; intlit: T_INT -- cgit v1.2.3