1 #ifndef __Instruction_h
2 #define __Instruction_h
3 #include "SchemeObject.h"
4 
5 typedef enum {
6     LABEL,
7     PUSH,
8     POP,
9     MAKECLOSURE,
10     MAKECONT,
11     LOADENV,
12     LOADLITS,
13     MAKEENV,
14     POPENV,
15     GET,
16     SET,
17     SETREST,
18     SETSTACK,
19     GETLINK,
20     GETGLOBAL,
21     SETGLOBAL,
22     CALL,
23     RETURN,
24     IFFALSE,
25     GOTO
26 } opcode_e;
27 
28 struct instruction_s {
29     opcode_e opcode;
30     int operand;
31 };
32 
33 typedef struct instruction_s instruction_t;
34 
35 @interface Instruction: SchemeObject
36 {
37     opcode_e opcode;
38     int operand, offset;
39     Instruction *label;
40 }
41 + (id) opcode: (opcode_e) oc;
42 + (id) opcode: (opcode_e) oc operand: (int) op;
43 + (id) opcode: (opcode_e) oc label: (Instruction *) l;
44 - (id) initWithOpcode: (opcode_e) oc operand: (int) op label: (Instruction *) l;
45 - (void) offset: (int) ofs;
46 - (int) offset;
47 - (opcode_e) opcode;
48 - (void) emitStruct: (instruction_t *) program;
49 
50 @end
51 
52 #endif //__Instruction_h
53