-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKobiLang.py
44 lines (38 loc) · 1.27 KB
/
KobiLang.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
Tokens = []
CurrentTok = ""
STDLIBCOMMANDS = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]
def Tokenize(input):
input = str(input)
Tokens.clear()
CurrentTok = ""
for x in range(len(input)):
if input[x] != ';' and input[x] != ' ' and input[x] != '(' and input[x] != ')' and input[x] != '"' and input[x] != ',':
CurrentTok += input[x]
else:
Tokens.append(CurrentTok)
CurrentTok = ""
execute_tokens()
def execute_tokens():
for x in range(len(Tokens)):
match Tokens[x]:
case "w":
for y in range(x+2, len(Tokens)):
if Tokens[y] != '"':
print(Tokens[y], end=" ")
else:
print()
break
print()
break
case "b":
break
case "a":
num_one = int(Tokens[x+1])
num_two = int(Tokenize[x+2])
print(num_one+num_two)
break
while 1:
UserInput = input()
if UserInput[len(UserInput)-1] != ';':
UserInput += ";"
Tokenize(UserInput)