File tree Expand file tree Collapse file tree 1 file changed +5
-33
lines changed Expand file tree Collapse file tree 1 file changed +5
-33
lines changed Original file line number Diff line number Diff line change 11import sys
22try :code = open (sys .argv [1 ]).read ()
3- except :print (f"Usage: py { __file__ .split (chr (0x5c ))[- 1 ]} \" (file name)\" " );exit ()
3+ except :print (f"Usage: python { __file__ .split (chr (0x5c ))[- 1 ]} \" (file name)\" " );exit ()
44targ = "" ;c = "" ;sub = tp = p = 0 ;ts = [];s = [];ld = []
5- print ("true" )
65while 1 :
7- try :
8- if code [p ]== '"' :
9- while code [p + 1 ]!= '"' :p += 1 ;ts .append (code [p ])
10- s .append ("" .join (ts ));ts .clear ();p += 1
11- elif code [p ]== '.' :print (s .pop (),end = "" )
12- elif code [p ]in list (map (str ,range (10 ))):s .append (int (code [p ]))
13- elif code [p ]== ',' :c = input ()
14- elif code [p ]== ':' :s .append (s [- 1 ])
15- elif code [p ]== "'" :s .append (c [0 ]);c = c [1 :]
16- elif code [p ]== '»' :
17- targ = code [p + 1 ];tp = p ;sub = 1
18- while 1 :
19- if code [p ]== targ and code [p + 1 ]== ":" :p += 1 ;break
20- if len (code )- 2 == p :p = 0
21- p += 1
22- elif code [p ]== ";" and sub == 1 :p = tp
23- elif code [p ]== "\n " :break
24- elif code [p ]== "-" :s .pop ()
25- elif code [p ]== "+" :s .append (int (s .pop ())+ int (s .pop ()))
26- elif code [p ]== "`" :s .append (int (s .pop ())* - 1 )
27- elif code [p ]== "(" :
28- while code [p + 1 ]!= ")" :ts .append (code [p + 1 ]);p += 1
29- ld .append ("" .join (ts ))
30- elif code [p ]== "[" :
31- while code [p ]!= "]" :p += 1
32- if len (code )- 1 == p :
33- while 1 :
34- if code [p ]== "\n " :break
35- elif p == 0 :p = - 1
36- p += 1
37- except IndexError :break
6+ if code [p ]== '"' :p += 1 ;s .append (code [p :code .index ('"' ,p )]);p = code .index ('"' ,p )
7+ elif code [p ]== "." :print (s .pop ())
8+ if code [p ]== "\n " :break
9+ p += 1
You can’t perform that action at this time.
0 commit comments