-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathidentifier.py
99 lines (96 loc) · 2.6 KB
/
identifier.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
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import fn_operations
import loop
import math_operations
import qqio
import queue
import cond
identifiers = {
'call': fn_operations.FnCall,
'def': fn_operations.FnDef,
'ret': fn_operations.Ret,
'exec': fn_operations.Exec,
'+': math_operations.Add,
'r+': math_operations.RAdd,
'q+': math_operations.QAdd,
'-': math_operations.Sub,
'r-': math_operations.RSub,
'q-': math_operations.QSub,
'*': math_operations.Mul,
'r*': math_operations.RMul,
'q*': math_operations.QMul,
'/': math_operations.Div,
'r/': math_operations.RDiv,
'q/': math_operations.QDiv,
'%': math_operations.Mod,
'r%': math_operations.RMod,
'q%': math_operations.QMod,
'**': math_operations.Exp,
'r**': math_operations.RExp,
'q**': math_operations.QExp,
'&': math_operations.BitAnd,
'r&': math_operations.RBitAnd,
'q&': math_operations.QBitAnd,
'|': math_operations.BitOr,
'r|': math_operations.RBitOr,
'q|': math_operations.QBitOr,
'^': math_operations.BitXor,
'r^': math_operations.RBitXor,
'q^': math_operations.QBitXor,
'inc': math_operations.Inc,
'rinc': math_operations.RInc,
'qinc': math_operations.QInc,
'dec': math_operations.Dec,
'rdec': math_operations.RDec,
'qdec': math_operations.QDec,
'QQ': qqio.QQ,
'read_line': qqio.ReadLine,
'read_num': qqio.ReadNumber,
'print': qqio.Print,
'write': qqio.Write,
'rot': queue.Rot,
'rrot': queue.RRot,
'qrot': queue.QRot,
'pop': queue.Pop,
'rpop': queue.RPop,
'qpop': queue.QPop,
'push': queue.Push,
'rpush': queue.RPush,
'qpush': queue.QPush,
'drain': queue.Drain,
'rdrain': queue.RDrain,
'qdrain': queue.QDrain,
'rqalloc': queue.RQAlloc,
'pack': queue.Pack,
'dup': queue.Dup,
'rdup': queue.RDup,
'qdup': queue.QDup,
'if': cond.If,
'ifelse': cond.IfElse,
'loop': loop.Loop,
'rifbreak': loop.RIfBreak,
'break': loop.Break,
'not': cond.Not,
'rnot': cond.RNot,
'qnot': cond.QNot,
'==': cond.Equals,
'r==': cond.REquals,
'q==': cond.QEquals,
'!=': cond.NotEquals,
'r!=': cond.RNotEquals,
'q!=': cond.QNotEquals,
'<': cond.LessThan,
'r<': cond.RLessThan,
'q<': cond.QLessThan,
'<=': cond.LessThanEquals,
'r<=': cond.RLessThanEquals,
'q<=': cond.QLessThanEquals,
'>': cond.GreaterThan,
'r>': cond.RGreaterThan,
'q>': cond.QGreaterThan,
'>=': cond.GreaterThanEquals,
'r>=': cond.RGreaterThanEquals,
'q>=': cond.QGreaterThanEquals,
}
def Identifier(name):
global identifiers
return identifiers[name]()