-
Notifications
You must be signed in to change notification settings - Fork 4
/
instruction-data.go
67 lines (60 loc) · 2.3 KB
/
instruction-data.go
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package bytecode
// Data specifies the name of an instruction, and whether or not it takes
// an argument.
type Data struct {
Name string
HasArg bool
}
// Instructions stores data about different instruction types.
var Instructions = map[byte]Data{
Nop: {Name: "NO_OP"},
NopArg: {Name: "NO_OP_ARG", HasArg: true},
LoadConst: {Name: "LOAD_CONST", HasArg: true},
LoadName: {Name: "LOAD_NAME", HasArg: true},
StoreName: {Name: "STORE_NAME", HasArg: true},
DeclareName: {Name: "DECLARE_NAME", HasArg: true},
LoadSubscript: {Name: "LOAD_SUBSCRIPT"},
StoreSubscript: {Name: "STORE_SUBSCRIPT"},
UnaryInvert: {Name: "UNARY_INVERT"},
UnaryNegate: {Name: "UNARY_NEGATE"},
UnaryTuple: {Name: "UNARY_TUPLE"},
BinaryAdd: {Name: "BINARY_ADD"},
BinarySub: {Name: "BINARY_SUB"},
BinaryMul: {Name: "BINARY_MUL"},
BinaryDiv: {Name: "BINARY_DIV"},
BinaryExp: {Name: "BINARY_EXP"},
BinaryFloorDiv: {Name: "BINARY_FLOOR_DIV"},
BinaryMod: {Name: "BINARY_MODULO"},
BinaryLogicOr: {Name: "BINARY_LOGIC_OR"},
BinaryLogicAnd: {Name: "BINARY_LOGIC_AND"},
BinaryBitOr: {Name: "BINARY_BIT_OR"},
BinaryBitAnd: {Name: "BINARY_BIT_AND"},
BinaryEqual: {Name: "BINARY_EQUAL"},
BinaryNotEqual: {Name: "BINARY_NOT_EQUAL"},
BinaryLess: {Name: "BINARY_LESS_THAN"},
BinaryMore: {Name: "BINARY_MORE_THAN"},
BinaryLessEq: {Name: "BINARY_LESS_EQ"},
BinaryMoreEq: {Name: "BINARY_MORE_EQ"},
BinaryTuple: {Name: "BINARY_TUPLE"},
CallFunction: {Name: "CALL_FUNCTION", HasArg: true},
Return: {Name: "RETURN"},
PushScope: {Name: "PUSH_SCOPE"},
PopScope: {Name: "POP_SCOPE"},
Export: {Name: "EXPORT", HasArg: true},
Jump: {Name: "JUMP", HasArg: true},
JumpIf: {Name: "JUMP_IF", HasArg: true},
JumpUnless: {Name: "JUMP_UNLESS", HasArg: true},
StartMatch: {Name: "START_MATCH"},
EndMatch: {Name: "END_MATCH"},
StartBranch: {Name: "START_BRANCH"},
EndBranch: {Name: "END_BRANCH"},
Break: {Name: "BREAK"},
Next: {Name: "NEXT"},
StartLoop: {Name: "START_LOOP"},
EndLoop: {Name: "END_LOOP"},
PushIter: {Name: "PUSH_ITER"},
PopIter: {Name: "POP_ITER"},
AdvIterFor: {Name: "ADV_ITER_FOR", HasArg: true},
MakeList: {Name: "MAKE_LIST", HasArg: true},
MakeMap: {Name: "MAKE_MAP", HasArg: true},
}