Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
31
Task/Execute-Brain-/Red/execute-brain-.red
Normal file
31
Task/Execute-Brain-/Red/execute-brain-.red
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
Red []
|
||||
|
||||
bf: function [prog [string!]][
|
||||
size: 30000
|
||||
cells: make string! size
|
||||
append/dup cells null size
|
||||
|
||||
parse prog [
|
||||
some [
|
||||
">" (cells: next cells)
|
||||
| "<" (cells: back cells)
|
||||
| "+" (cells/1: cells/1 + 1)
|
||||
| "-" (cells/1: cells/1 - 1)
|
||||
| "." (prin cells/1)
|
||||
| "," (cells/1: first input "")
|
||||
| "[" [if (cells/1 = null) thru "]" | none]
|
||||
| "]" [
|
||||
pos: if (cells/1 <> null)
|
||||
(pos: find/reverse pos #"[") :pos
|
||||
| none
|
||||
]
|
||||
| skip
|
||||
]
|
||||
]
|
||||
]
|
||||
|
||||
; This code will print a Hello World! message
|
||||
bf {
|
||||
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.
|
||||
>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue