test.ion 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. fn execute_bf program
  2. let program_len:int program_counter:int \
  3. memory:hmap[int] memory_pointer:int \
  4. stack:hmap[int] stack_pointer:int \
  5. jumps:hmap[int] jumps_program_counter:int \
  6. = $len(program) 0 [] 0 [] 0 [] 0
  7. let program: [str] = [ @chars(program) ]
  8. while test $jumps_program_counter -lt $program_len
  9. if test @program[$jumps_program_counter] = "["
  10. let search_depth: int = 0
  11. let jump_target: int = $jumps_program_counter
  12. while test $search_depth -ge 0
  13. let jump_target += 1
  14. test $jump_target -ge $program_len && exit
  15. match @program[$jump_target]
  16. case "["; let search_depth += 1
  17. case "]"; let search_depth -= 1
  18. end
  19. end
  20. let jumps[$jumps_program_counter] = $jump_target
  21. end
  22. let jumps_program_counter += 1
  23. end
  24. let memory[0] = 0
  25. while test $program_counter -lt $program_len
  26. match @program[$program_counter]
  27. case "+" if test @memory[$memory_pointer] -eq 255
  28. let memory[$memory_pointer] = 0
  29. case "+"
  30. let memory_value = @memory[$memory_pointer]
  31. let memory[$memory_pointer] = $((1 + memory_value))
  32. # TODO: let memory[$memory_pointer] += 1
  33. case "-" if test @memory[$memory_pointer] -eq 0
  34. let memory[$memory_pointer] = 255
  35. case "-"
  36. let memory_value = @memory[$memory_pointer]
  37. let memory[$memory_pointer] = $((-1 + memory_value))
  38. # TODO: let memory[$memory_pointer] -= 1
  39. case ">"
  40. let memory_pointer += 1
  41. if test @memory[$memory_pointer] = ""
  42. let memory[$memory_pointer] = 0
  43. end
  44. case "<"
  45. let memory_pointer -= 1
  46. if test @memory[$memory_pointer] = ""
  47. let memory[$memory_pointer] = 0
  48. end
  49. case "["
  50. let memory_value = @memory[$memory_pointer]
  51. if test $memory_value -ne 0
  52. let stack[$stack_pointer] = $program_counter
  53. let stack_pointer += 1
  54. else
  55. let program_counter = @jumps[$program_counter]
  56. end
  57. case "]"
  58. let stack_pointer -= 1
  59. let program_counter = @stack[$stack_pointer]
  60. let program_counter -= 1
  61. case "."
  62. # TODO: Nicer decimal to ASCII conversion
  63. printf \\$(printf '%03o' @memory[$memory_pointer])
  64. case ","
  65. echo Input not supported yet
  66. end
  67. let program_counter += 1
  68. end
  69. end
  70. if test @args[1] != ""
  71. execute_bf @args[1]
  72. else
  73. execute_bf '-[------->+<]>.++++++.-.++[----->++<]>.>-[--->+<]>--.----------\
  74. -.---.+++++++..>++++++++++.'
  75. execute_bf '++++[++++>---<]>-.>-[--->+<]>---.--[->++++<]>+.++++++++.+++++.-\
  76. -------.>-[--->+<]>.-[----->+<]>-.++++++++.---[->++++<]>.++[->++<]>.+.+\
  77. +++++++.++.>++++++++++.'
  78. # https://github.com/brain-lang/brainfuck/blob/master/examples/sierpinski.bf
  79. execute_bf '[.--..]++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[->[+[-]\
  80. +>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<]>.>+[>>]>+][.]'
  81. # https://www.rosettacode.org/wiki/99_Bottles_of_Beer/EsoLang
  82. execute_bf '>+++++++++[<+++++++++++>-]<[>[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]\
  83. <<<+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]++++++\
  84. +++>[<->-]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]>\
  85. [<+>-]<<-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]\
  86. >>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++\
  87. ++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-\
  88. ]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>++\
  89. +++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<++\
  90. +++++++++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++\
  91. [<+++++++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-\
  92. ]<++++.------------.---.>+++++++[<---------->-]<+.>++++++++[<++++++++++\
  93. +>-]<-.>++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<----\
  94. -.---.>>>[>+>+<<-]>>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>>++++[<++++++>-]<--\
  95. .>++++[<++++++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.\
  96. >>[>>+>+<<<-]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++\
  97. ++++>-]<.>+++++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<\
  98. .>++++++[<+++++++++++>-]<.+++..+++++++++++++.>++++++++++[<---------->-]\
  99. <-.---.>+++++++[<++++++++++>-]<++++.+++++++++++++.++++++++++.------.>++\
  100. +++++[<---------->-]<+.>++++++++[<++++++++++>-]<-.-.---------.>+++++++[\
  101. <---------->-]<+.>+++++++[<++++++++++>-]<--.+++++++++++.++++++++.------\
  102. ---.>++++++++[<---------->-]<++.>+++++[<+++++++++++++>-]<.+++++++++++++\
  103. .----------.>+++++++[<---------->-]<++.>++++++++[<++++++++++>-]<.>+++[<\
  104. ----->-]<.>+++[<++++++>-]<..>+++++++++[<--------->-]<--.>+++++++[<+++++\
  105. +++++>-]<+++.+++++++++++.>++++++++[<----------->-]<++++.>+++++[<+++++++\
  106. ++++++>-]<.>+++[<++++++>-]<-.---.++++++.-------.----------.>++++++++[<-\
  107. ---------->-]<+.---.[-]<<<->[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]<<<++++++\
  108. +++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]+++++++++>[<->-\
  109. ]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]<>>[<+>-]<\
  110. <-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]>>[<<+>\
  111. >-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++++++>-]\
  112. <++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-]>>>[<<\
  113. <+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>+++++++++\
  114. [<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<+++++++++\
  115. ++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++[<+++++\
  116. ++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-]<++++.\
  117. ------------.---.>+++++++[<---------->-]<+.>++++++++[<+++++++++++>-]<-.\
  118. >++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<-----.---.+\
  119. ++.---.[-]<<<]'
  120. end
  121. fn execute_bf program
  122. let program_len:int program_counter:int \
  123. memory:hmap[int] memory_pointer:int \
  124. stack:hmap[int] stack_pointer:int \
  125. jumps:hmap[int] jumps_program_counter:int \
  126. = $len(program) 0 [] 0 [] 0 [] 0
  127. let program: [str] = [ @chars(program) ]
  128. while test $jumps_program_counter -lt $program_len
  129. if test @program[$jumps_program_counter] = "["
  130. let search_depth: int = 0
  131. let jump_target: int = $jumps_program_counter
  132. while test $search_depth -ge 0
  133. let jump_target += 1
  134. test $jump_target -ge $program_len && exit
  135. match @program[$jump_target]
  136. case "["; let search_depth += 1
  137. case "]"; let search_depth -= 1
  138. end
  139. end
  140. let jumps[$jumps_program_counter] = $jump_target
  141. end
  142. let jumps_program_counter += 1
  143. end
  144. let memory[0] = 0
  145. while test $program_counter -lt $program_len
  146. match @program[$program_counter]
  147. case "+" if test @memory[$memory_pointer] -eq 255
  148. let memory[$memory_pointer] = 0
  149. case "+"
  150. let memory_value = @memory[$memory_pointer]
  151. let memory[$memory_pointer] = $((1 + memory_value))
  152. # TODO: let memory[$memory_pointer] += 1
  153. case "-" if test @memory[$memory_pointer] -eq 0
  154. let memory[$memory_pointer] = 255
  155. case "-"
  156. let memory_value = @memory[$memory_pointer]
  157. let memory[$memory_pointer] = $((-1 + memory_value))
  158. # TODO: let memory[$memory_pointer] -= 1
  159. case ">"
  160. let memory_pointer += 1
  161. if test @memory[$memory_pointer] = ""
  162. let memory[$memory_pointer] = 0
  163. end
  164. case "<"
  165. let memory_pointer -= 1
  166. if test @memory[$memory_pointer] = ""
  167. let memory[$memory_pointer] = 0
  168. end
  169. case "["
  170. let memory_value = @memory[$memory_pointer]
  171. if test $memory_value -ne 0
  172. let stack[$stack_pointer] = $program_counter
  173. let stack_pointer += 1
  174. else
  175. let program_counter = @jumps[$program_counter]
  176. end
  177. case "]"
  178. let stack_pointer -= 1
  179. let program_counter = @stack[$stack_pointer]
  180. let program_counter -= 1
  181. case "."
  182. # TODO: Nicer decimal to ASCII conversion
  183. printf \\$(printf '%03o' @memory[$memory_pointer])
  184. case ","
  185. echo Input not supported yet
  186. end
  187. let program_counter += 1
  188. end
  189. end
  190. if test @args[1] != ""
  191. execute_bf @args[1]
  192. else
  193. execute_bf '-[------->+<]>.++++++.-.++[----->++<]>.>-[--->+<]>--.----------\
  194. -.---.+++++++..>++++++++++.'
  195. execute_bf '++++[++++>---<]>-.>-[--->+<]>---.--[->++++<]>+.++++++++.+++++.-\
  196. -------.>-[--->+<]>.-[----->+<]>-.++++++++.---[->++++<]>.++[->++<]>.+.+\
  197. +++++++.++.>++++++++++.'
  198. # https://github.com/brain-lang/brainfuck/blob/master/examples/sierpinski.bf
  199. execute_bf '[.--..]++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[->[+[-]\
  200. +>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<]>.>+[>>]>+][.]'
  201. # https://www.rosettacode.org/wiki/99_Bottles_of_Beer/EsoLang
  202. execute_bf '>+++++++++[<+++++++++++>-]<[>[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]\
  203. <<<+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]++++++\
  204. +++>[<->-]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]>\
  205. [<+>-]<<-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]\
  206. >>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++\
  207. ++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-\
  208. ]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>++\
  209. +++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<++\
  210. +++++++++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++\
  211. [<+++++++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-\
  212. ]<++++.------------.---.>+++++++[<---------->-]<+.>++++++++[<++++++++++\
  213. +>-]<-.>++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<----\
  214. -.---.>>>[>+>+<<-]>>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>>++++[<++++++>-]<--\
  215. .>++++[<++++++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.\
  216. >>[>>+>+<<<-]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++\
  217. ++++>-]<.>+++++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<\
  218. .>++++++[<+++++++++++>-]<.+++..+++++++++++++.>++++++++++[<---------->-]\
  219. <-.---.>+++++++[<++++++++++>-]<++++.+++++++++++++.++++++++++.------.>++\
  220. +++++[<---------->-]<+.>++++++++[<++++++++++>-]<-.-.---------.>+++++++[\
  221. <---------->-]<+.>+++++++[<++++++++++>-]<--.+++++++++++.++++++++.------\
  222. ---.>++++++++[<---------->-]<++.>+++++[<+++++++++++++>-]<.+++++++++++++\
  223. .----------.>+++++++[<---------->-]<++.>++++++++[<++++++++++>-]<.>+++[<\
  224. ----->-]<.>+++[<++++++>-]<..>+++++++++[<--------->-]<--.>+++++++[<+++++\
  225. +++++>-]<+++.+++++++++++.>++++++++[<----------->-]<++++.>+++++[<+++++++\
  226. ++++++>-]<.>+++[<++++++>-]<-.---.++++++.-------.----------.>++++++++[<-\
  227. ---------->-]<+.---.[-]<<<->[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]<<<++++++\
  228. +++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]+++++++++>[<->-\
  229. ]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]<>>[<+>-]<\
  230. <-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]>>[<<+>\
  231. >-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++++++>-]\
  232. <++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-]>>>[<<\
  233. <+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>+++++++++\
  234. [<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<+++++++++\
  235. ++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++[<+++++\
  236. ++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-]<++++.\
  237. ------------.---.>+++++++[<---------->-]<+.>++++++++[<+++++++++++>-]<-.\
  238. >++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<-----.---.+\
  239. ++.---.[-]<<<]'
  240. end
  241. fn execute_bf program
  242. let program_len:int program_counter:int \
  243. memory:hmap[int] memory_pointer:int \
  244. stack:hmap[int] stack_pointer:int \
  245. jumps:hmap[int] jumps_program_counter:int \
  246. = $len(program) 0 [] 0 [] 0 [] 0
  247. let program: [str] = [ @chars(program) ]
  248. while test $jumps_program_counter -lt $program_len
  249. if test @program[$jumps_program_counter] = "["
  250. let search_depth: int = 0
  251. let jump_target: int = $jumps_program_counter
  252. while test $search_depth -ge 0
  253. let jump_target += 1
  254. test $jump_target -ge $program_len && exit
  255. match @program[$jump_target]
  256. case "["; let search_depth += 1
  257. case "]"; let search_depth -= 1
  258. end
  259. end
  260. let jumps[$jumps_program_counter] = $jump_target
  261. end
  262. let jumps_program_counter += 1
  263. end
  264. let memory[0] = 0
  265. while test $program_counter -lt $program_len
  266. match @program[$program_counter]
  267. case "+" if test @memory[$memory_pointer] -eq 255
  268. let memory[$memory_pointer] = 0
  269. case "+"
  270. let memory_value = @memory[$memory_pointer]
  271. let memory[$memory_pointer] = $((1 + memory_value))
  272. # TODO: let memory[$memory_pointer] += 1
  273. case "-" if test @memory[$memory_pointer] -eq 0
  274. let memory[$memory_pointer] = 255
  275. case "-"
  276. let memory_value = @memory[$memory_pointer]
  277. let memory[$memory_pointer] = $((-1 + memory_value))
  278. # TODO: let memory[$memory_pointer] -= 1
  279. case ">"
  280. let memory_pointer += 1
  281. if test @memory[$memory_pointer] = ""
  282. let memory[$memory_pointer] = 0
  283. end
  284. case "<"
  285. let memory_pointer -= 1
  286. if test @memory[$memory_pointer] = ""
  287. let memory[$memory_pointer] = 0
  288. end
  289. case "["
  290. let memory_value = @memory[$memory_pointer]
  291. if test $memory_value -ne 0
  292. let stack[$stack_pointer] = $program_counter
  293. let stack_pointer += 1
  294. else
  295. let program_counter = @jumps[$program_counter]
  296. end
  297. case "]"
  298. let stack_pointer -= 1
  299. let program_counter = @stack[$stack_pointer]
  300. let program_counter -= 1
  301. case "."
  302. # TODO: Nicer decimal to ASCII conversion
  303. printf \\$(printf '%03o' @memory[$memory_pointer])
  304. case ","
  305. echo Input not supported yet
  306. end
  307. let program_counter += 1
  308. end
  309. end
  310. if test @args[1] != ""
  311. execute_bf @args[1]
  312. else
  313. execute_bf '-[------->+<]>.++++++.-.++[----->++<]>.>-[--->+<]>--.----------\
  314. -.---.+++++++..>++++++++++.'
  315. execute_bf '++++[++++>---<]>-.>-[--->+<]>---.--[->++++<]>+.++++++++.+++++.-\
  316. -------.>-[--->+<]>.-[----->+<]>-.++++++++.---[->++++<]>.++[->++<]>.+.+\
  317. +++++++.++.>++++++++++.'
  318. # https://github.com/brain-lang/brainfuck/blob/master/examples/sierpinski.bf
  319. execute_bf '[.--..]++++++++[>+>++++<<-]>++>>+<[-[>>+<<-]+>>]>+[-<<<[->[+[-]\
  320. +>++>>>-<<]<[<]>>++++++[<<+++++>>-]+<<++.[-]<<]>.>+[>>]>+][.]'
  321. # https://www.rosettacode.org/wiki/99_Bottles_of_Beer/EsoLang
  322. execute_bf '>+++++++++[<+++++++++++>-]<[>[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]\
  323. <<<+++++++++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]++++++\
  324. +++>[<->-]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]>\
  325. [<+>-]<<-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]\
  326. >>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++\
  327. ++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-\
  328. ]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>++\
  329. +++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<++\
  330. +++++++++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++\
  331. [<+++++++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-\
  332. ]<++++.------------.---.>+++++++[<---------->-]<+.>++++++++[<++++++++++\
  333. +>-]<-.>++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<----\
  334. -.---.>>>[>+>+<<-]>>[<<+>>-]<[<<<<<.>>>>>-]<<<<<<.>>>++++[<++++++>-]<--\
  335. .>++++[<++++++++>-]<++.>+++++[<+++++++++>-]<.><+++++..--------.-------.\
  336. >>[>>+>+<<<-]>>>[<<<+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++\
  337. ++++>-]<.>+++++++++[<+++++++++>-]<--.---------.>+++++++[<---------->-]<\
  338. .>++++++[<+++++++++++>-]<.+++..+++++++++++++.>++++++++++[<---------->-]\
  339. <-.---.>+++++++[<++++++++++>-]<++++.+++++++++++++.++++++++++.------.>++\
  340. +++++[<---------->-]<+.>++++++++[<++++++++++>-]<-.-.---------.>+++++++[\
  341. <---------->-]<+.>+++++++[<++++++++++>-]<--.+++++++++++.++++++++.------\
  342. ---.>++++++++[<---------->-]<++.>+++++[<+++++++++++++>-]<.+++++++++++++\
  343. .----------.>+++++++[<---------->-]<++.>++++++++[<++++++++++>-]<.>+++[<\
  344. ----->-]<.>+++[<++++++>-]<..>+++++++++[<--------->-]<--.>+++++++[<+++++\
  345. +++++>-]<+++.+++++++++++.>++++++++[<----------->-]<++++.>+++++[<+++++++\
  346. ++++++>-]<.>+++[<++++++>-]<-.---.++++++.-------.----------.>++++++++[<-\
  347. ---------->-]<+.---.[-]<<<->[-]>[-]<<[>+>+<<-]>>[<<+>>-]>>>[-]<<<++++++\
  348. +++<[>>>+<<[>+>[-]<<-]>[<+>-]>[<<++++++++++>>>+<-]<<-<-]+++++++++>[<->-\
  349. ]>>+>[<[-]<<+>>>-]>[-]+<<[>+>-<<-]<<<[>>+>+<<<-]>>>[<<<+>>>-]<>>[<+>-]<\
  350. <-[>[-]<[-]]>>+<[>[-]<-]<++++++++[<++++++<++++++>>-]>>>[>+>+<<-]>>[<<+>\
  351. >-]<[<<<<<.>>>>>-]<<<<<<.>>[-]>[-]++++[<++++++++>-]<.>++++[<++++++++>-]\
  352. <++.>+++++[<+++++++++>-]<.><+++++..--------.-------.>>[>>+>+<<<-]>>>[<<\
  353. <+>>>-]<[<<<<++++++++++++++.>>>>-]<<<<[-]>++++[<++++++++>-]<.>+++++++++\
  354. [<+++++++++>-]<--.---------.>+++++++[<---------->-]<.>++++++[<+++++++++\
  355. ++>-]<.+++..+++++++++++++.>++++++++[<---------->-]<--.>+++++++++[<+++++\
  356. ++++>-]<--.-.>++++++++[<---------->-]<++.>++++++++[<++++++++++>-]<++++.\
  357. ------------.---.>+++++++[<---------->-]<+.>++++++++[<+++++++++++>-]<-.\
  358. >++[<----------->-]<.+++++++++++..>+++++++++[<---------->-]<-----.---.+\
  359. ++.---.[-]<<<]'
  360. end