summaryrefslogtreecommitdiff
path: root/nqasm.h
blob: 3e6ec72addc2ee42c053c58575c7da39d6dd2e87 (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
40
41
42
43
44
#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,

	ARG_ADD,
	ARG_SUB,
	ARG_MUL,
	ARG_DIV,
};

struct argument {
	int type;
	union {
		long value;
		char *label;
		const struct argument *children[2];
	};
};

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