-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdef.go
77 lines (69 loc) · 1.24 KB
/
def.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
68
69
70
71
72
73
74
75
76
77
// Grass-Mud-Horse VM in Golang
// https://code.google.com/p/grass-mud-horse/wiki/A_Brife_To_GrassMudHorse_Language
// An accent of Whitespace language
// [Space] -> 草
// [Tab] -> 泥
// [LF] -> 马
package gmh
// The Grass-Mud-Horse Virtual Machine
type VM struct {
stack *stack
heap []int
interrupter func() bool
input func(string) string
buf string
}
// Grass-Mud-Horse Instruction Modification Parameter
const (
STACK = "草"
MATH = "泥草"
HEAP = "泥泥"
FLOW = "马"
IO = "泥马"
)
// Stack Manipulation
const (
PUSH = "草"
DUPLICATE = "马草"
COPY = "泥草"
SWAP = "马泥"
DISCARD = "马马"
SLIDE = "泥马"
)
// Arithmetic
const (
ADD = "草草"
SUB = "草泥"
MUL = "草马"
DIV = "泥草"
MOD = "泥泥"
)
// Heap
const (
STORE = "草"
RETRIEVE = "泥"
)
// Flow control
const (
MARK = "草草"
CALL = "草泥"
JUMP = "草马"
JUMP_ZERO = "泥草"
JUMP_SUBZERO = "泥泥"
RETURN = "泥马"
END1 = "马马"
END2 = "河蟹"
)
// I/O
const (
PRINT_CHAR = "草草"
PRINT_NUM = "草泥"
SCAN_CHAR = "泥草"
SCAN_NUM = "泥泥"
)
// Numbers
const (
ZERO = "草"
ONE = "泥"
NUM_END = "马"
)