Handbook
Glossary
interpret-brainfuck-from ( str i brainfuck -- str next/f brainfuck )
Vocabulary
brainfuck
.
private
Inputs
str
an
object
i
an
object
brainfuck
an
object
Outputs
str
an
object
next/f
an
object
brainfuck
an
object
Definition
USING:
ascii
combinators
kernel
math
sequences
;
IN:
brainfuck.private
:
interpret-brainfuck-from
( str i brainfuck -- str next/f brainfuck )
2over
swap
?nth
[
1
+
]
2dip
{
{
62
[
1
(>)
]
}
{
60
[
1
(<)
]
}
{
43
[
1
(+)
]
}
{
45
[
1
(-)
]
}
{
46
[
(.)
]
}
{
44
[
(,)
]
}
{
35
[
(#)
]
}
{
91
[
get-memory
zero?
[
[
end-loop
]
dip
]
when
]
}
{
93
[
get-memory
zero?
[
[
start-loop
]
dip
]
unless
]
}
{
f
[
[
drop
f
]
dip
]
}
[
blank?
[
"Invalid input"
throw
]
unless
]
}
case
;