Skip to content

Commit 2d98673

Browse files
authored
Update tpy.py
1 parent 80d458f commit 2d98673

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

true/tpy.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
"in progress"
21
import sys
32
try: code = open(sys.argv[1]).read()
43
except: print(f"Usage: python {__file__.split(chr(0x5c))[-1]} \"(file name)\"");exit()
5-
p = 0;ts = [];s = []
4+
p = 0; ts = []; s = []
65
while 1:
76
if code[p] == '"' :
87
p+=1;s.append(code[p : code.index('"', p)])
@@ -11,6 +10,10 @@
1110
elif code[p] == "," : s.append(input())
1211
elif code[p] in "0123456789" : s.append(int(code[p]))
1312
elif code[p] == "[" : p=code.index("]", p)
13+
elif code[p] == "+" : s.append(int(s.pop())+int(s.pop()))
14+
elif code[p] == "-" : s.pop()
15+
elif code[p] == "`" : s.append(int(s.pop())*-1)
16+
elif code[p] == ":" : s.append(s[-1])
1417
if code[p] == "\n" : break
15-
if len(code) == p +1: p = -1
18+
if len(code) == p +1 : p = -1
1619
p += 1

0 commit comments

Comments
 (0)