fork download
  1. def isfloat(num):
  2. try:
  3. float(num)
  4. return True
  5. except ValueError:
  6. return False
  7. file=open(input('.gar: ')+'.gar','r').readlines();import time as t
  8. for i in range(len(file)):
  9. if'\n'in file[i]:
  10. file[i]=file[i][:-1]
  11. stack=[]
  12. j=0
  13. while j < len(file):
  14. try:
  15. inp=''
  16. k=file[j]
  17. error='1'
  18. if k[0]=='>':
  19. error='0'
  20. stack+=[k.count('>')]
  21. if k[0]=='<':
  22. error='0'
  23. stack+=[-k.count('<')]
  24. if k=='+':
  25. error='0'
  26. stack+=[stack[-1]+stack[-2]]
  27. del stack[-2]
  28. del stack[-2]
  29. if k=='-':
  30. error='0'
  31. stack+=[stack[-1]-stack[-2]]
  32. del stack[-2]
  33. del stack[-2]
  34. if k=='*':
  35. error='0'
  36. stack+=[stack[-1]*stack[-2]]
  37. del stack[-2]
  38. del stack[-2]
  39. if k=='/':
  40. error='0'
  41. stack+=[stack[-1]/stack[-2]]
  42. del stack[-2]
  43. del stack[-2]
  44. if k=='%':
  45. error='0'
  46. stack+=[stack[-1]%stack[-2]]
  47. del stack[-2]
  48. del stack[-2]
  49. if k=='!':
  50. error='0'
  51. print(stack[-1])
  52. del stack[-1]
  53. if k=='!!':
  54. error='0'
  55. print(' '.join(str(z) for z in stack))
  56. if k==',':
  57. error='0'
  58. print(chr(stack[-1]))
  59. del stack[-1]
  60. if k=="|":
  61. error='0'
  62. stack+=[-stack[-1]]
  63. del stack[-2]
  64. if k==',,':
  65. error='0'
  66. print(''.join(chr(x) for x in stack))
  67. if k=='~':
  68. error='0'
  69. del stack[-1]
  70. if k=='~~':
  71. error='0'
  72. stack=[]
  73. if k==':':
  74. error='0'
  75. stack+=[stack[-1]]
  76. if k=='::':
  77. error='0'
  78. stack+=[stack[-1]]
  79. stack[-2]=stack[-3]
  80. if k=='&':
  81. error='0'
  82. stack[-1],stack[-2]=stack[-2],stack[-1]
  83. if k=='&&':
  84. error='0'
  85. stack=stack[::-1]
  86. if k[0] in '{[(':
  87. error='0'
  88. if k[0]=='#':
  89. error='0'
  90. if k[0]=='}':
  91. error='0'
  92. j=file.index('{'*k.count('}'))
  93. t.sleep(0.1)
  94. if k[0]==')':
  95. error='0'
  96. j=file.index('('*k.count(')'))
  97. if k[0]==']':
  98. error='0'
  99. if not stack[-1]==0:
  100. j=file.index('['*k.count(']'))
  101. if k=='?':
  102. error='0'
  103. while not isfloat(inp):
  104. inp=input('> ')
  105. stack+=[float(inp)]
  106. if k=='??':
  107. error='0'
  108. while not len(inp)==1:
  109. inp=input('> ')
  110. stack+=[ord(inp)]
  111. if k=='???':
  112. error='0'
  113. stack+=[ord(x) for x in [*input('> ')]]
  114. if k=='f':
  115. error='0'
  116. stack=(ord(x) for x in [*(''.join(open(''.join(chr(x) for x in stack),'r').readlines()))])
  117. if k=='v':
  118. error='0'
  119. save1=list(stack)
  120. if k=='vv':
  121. error='0'
  122. stack+=save1
  123. if k=='vvv':
  124. error='0'
  125. stack=list(save1)
  126. if k=='^':
  127. error='0'
  128. save2=list(stack)
  129. if k=='^^':
  130. error='0'
  131. stack+=save2
  132. if k=='^^^':
  133. error='0'
  134. stack=list(save2)
  135. if k=='$':
  136. error='0'
  137. save3=list(stack)
  138. if k=='$$':
  139. error='0'
  140. stack+=save3
  141. if k=='$$$':
  142. error='0'
  143. stack=list(save3)
  144. if k=='"':
  145. error='0'
  146. stack+=(ord(x) for x in str(stack[-1]))
  147. if error=='1':
  148. print("{ERROR}")
  149. break
  150. j+=1
  151. #print(stack)
  152. except:
  153. print("{ERROR}")
  154. break
  155. t.sleep(10000)
Runtime error #stdin #stdout #stderr 0.16s 26052KB
stdin
Standard input is empty
stdout
.gar: 
stderr
Traceback (most recent call last):
  File "./prog.py", line 7, in <module>
EOFError: EOF when reading a line