-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
47 lines (41 loc) · 763 Bytes
/
test.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
import yaml
unchanged = [
'+', '-', '*', '/',
'>', '<',
'(', ')',
'[', ']',
',',
'"', "'"
]
translate = {
"\u2190": "=",
"=": "==",
"DISPLAY": "print",
"INPUT": "input",
"MOD": "%",
"RANDOM": "randint",
"\u2260": "!=",
"\u2264": "<=",
"\u2265": ">=",
"NOT": "not",
"AND": "and",
"OR": "or",
"IF": "if",
"ELSE": "else",
"LENGTH": "len",
"PROCEDURE": "def",
"RETURN": "return"
}
uncommons = {
"<-": "\u2190",
"!=": "\u2260",
"<=": "\u2264",
">=": "\u2265"
}
elements = {
"unchanged": unchanged,
"translate": translate,
"uncommons": uncommons
}
with open("elements.yaml", 'w') as file:
yaml.dump(elements, file, Dumper=yaml.Dumper)