summaryrefslogtreecommitdiff
path: root/nqasm.h
blob: e5a7452be1f69b1d7f719673c05d67f34d5ffaa3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef NQ_NQASM_H
#define NQ_NQASM_H

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];
	};
};

struct arguments {
	struct argument args[3];
};

struct instruction {
	int mnem;
	struct arguments args;
};

void add_instruction(const struct instruction *);
void add_label(const char *);

struct argument *argdup(const struct argument *);

#endif