From 6c6b91f9a6bc5ae203e99ac7abb3a70215488a6f Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Wed, 18 Jan 2017 19:40:18 -0600 Subject: nqasm: support unary operators in immediate expressions --- nqasm.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'nqasm.h') diff --git a/nqasm.h b/nqasm.h index 0bc51f7..e5a7452 100644 --- a/nqasm.h +++ b/nqasm.h @@ -1,15 +1,23 @@ #ifndef NQ_NQASM_H #define NQ_NQASM_H -#define ARG_INTEGER 0 -#define ARG_LABEL 1 -#define ARG_PC 2 +enum { + ARG_INTEGER, + ARG_LABEL, + ARG_PC, + + ARG_UNARY_ADD, + ARG_UNARY_SUB, + ARG_UNARY_NOT, + ARG_UNARY_INV, +}; struct argument { int type; union { long value; char *label; + const struct argument *children[1]; }; }; @@ -25,5 +33,7 @@ struct instruction { void add_instruction(const struct instruction *); void add_label(const char *); +struct argument *argdup(const struct argument *); + #endif -- cgit v1.2.3