-
Notifications
You must be signed in to change notification settings - Fork 1
/
const.py
48 lines (41 loc) · 1.24 KB
/
const.py
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
# coding: utf-8
# Author: Jeong YunWon(https://github.com/youknowone), http://aheui.github.com/
# This compiler imported from the rpaheui repo(https://github.com/aheui/rpaheui) to make AheuiCC
# The corresponding commit version is f9175e7
# If have any problems with copyright(e.g LICENSE) using this source file, please contact me(https://github.com/Algy)
OP_REQSIZE = [0, 0, 2, 2, 2, 2, 1, 0, 1, 0, 1, 0, 2, 0, 1, 0, 2, 2, 0, 1, 1, 0, 0, 2, 1, 0]
OP_STACKDEL = [0, 0, 2, 2, 2, 2, 1, 0, 1, 0, 1, 0, 2, 0, 1, 0, 2, 2, 0, 1, 1, 0, 0, 0, 0, 0]
OP_STACKADD = [0, 0, 1, 1, 1, 1, 0, 1, 2, 0, 0, 0, 1, 0, 0, 0, 1, 2, 0, 0, 0, 1, 1, 0, 0, 0]
VAL_QUEUE = 21
VAL_PORT = 27
STORAGE_COUNT = 28
# ㄱ
# ㄲ
OP_DIV = 2 # ㄴ
OP_ADD = 3 # ㄷ
OP_MUL = 4 # ㄸ
OP_MOD = 5 # ㄹ
OP_POP = 6 # ㅁ
OP_PUSH= 7 # ㅂ
OP_DUP = 8 # ㅃ
OP_SEL = 9 # ㅅ
OP_MOV = 10 # ㅆ
OP_NONE= 11 # ㅇ
OP_CMP = 12 # ㅈ
# ㅉ
OP_BRZ = 14
# ㅋ
OP_SUB = 16 # ㅌ
OP_SWAP= 17 # ㅍ
OP_HALT= 18 # ㅎ
## end of primitive
OP_POPNUM = 19
OP_POPCHAR = 20
OP_PUSHNUM = 21
OP_PUSHCHAR = 22
OP_BRPOP2 = -3 # special
OP_BRPOP1 = -2 # special
OP_JMP = -1 # special
OP_BRANCHES = [OP_BRZ, OP_BRPOP1, OP_BRPOP2]
OP_JUMPS = OP_BRANCHES + [OP_JMP]
OP_BINARYOPS = [OP_DIV, OP_ADD, OP_MUL, OP_MOD, OP_CMP, OP_SUB]