Execute Brain****/Standard ML: Difference between revisions
m
Fixed syntax highlighting.
m (Categorization now in master page) |
m (Fixed syntax highlighting.) |
||
(One intermediate revision by one other user not shown) | |||
Line 10:
A more efficient implementation could for example only admit well-bracketed brainfuck programs, and parse bracket blocks first, to replace the ''matchLeft'' and ''matchRight'' which need linear time.
<
fun moveRight (l, x::r) = (x::l, r)
Line 43:
| exec (p as (_, #"]"::_), d ) = exec (matchLeft (moveLeft p), d)
fun run s = exec (([], s), ([0], [0]))</
Example output:
|