Adicionado operadores relacionais.
[myPerl.git] / code.h
blobc479b4734c19a4acb62fa52a445a7f062507b752
1 #ifndef __CODE_H__
2 #define __CODE_H__
4 enum {
5 HALT,
6 ADD,
7 SUB,
8 MUL,
9 DIV,
10 MOD,
11 CMP_EQL,
12 CMP_NE,
13 CMP_GEQL,
14 CMP_LEQL,
15 CMP_GT,
16 CMP_LT,
17 LOAD_VAR,
18 LOAD_INT,
19 LOAD_OFF,
20 STORE,
21 JMP_FALSE,
22 GOTO,
23 WRITE_INT,
24 PUSH_INT,
25 PUSH_VAR,
26 CALL,
27 RET
30 /* For use by the virtual machine mainly */
31 struct ops {
32 char *opname;
33 void (*op)(int arg);
36 typedef struct code {
37 int op;
38 int arg;
39 } code_t;
41 /* defined in code.c */
42 extern struct ops ops[];
43 extern int code_offset;
44 extern code_t code[];
46 int reserve_loc(void);
47 int gen_label(void);
48 void gen_code(int op, int arg);
49 void back_patch(int addr, int op, int arg);
50 void print_code(char *output);
52 #endif /* !__CODE_H__ */