Execute Brain****/OCaml: Difference between revisions

m
<lang>
m (<code>)
m (<lang>)
Line 10:
A more efficient implementation could for example only admit well-bracketed brainfuck programs, and parse bracket blocks first, to replace the ''match_left'' and ''match_right'' which need linear time.
 
<codelang ocaml>
let move_left (x::l, r) = (l, x::r)
let move_right (l, x::r) = (x::l, r)
Line 68:
 
let run s = exec ([], s) ([0], [0])
</codelang>
 
Example output:
973

edits