Crate bf

source
Expand description

Brainfuck VM.

This example implements a simple brainfuck interpreter [BrainfuckInterp] and a jit compiler [BrainfuckJit].

Brainfuck is an esoteric programming languge existing of 8 commands.

  • > increment data pointer.
  • < decrement data pointer.
  • + increment data at current data pointer.
  • - decrement data at current data pointer.
  • . output data at current data pointer.
  • , read input and store at current data pointer.
  • [ jump behind matching ] if data at data pointer is zero.
  • ] jump behind matching [ if data at data pointer is non-zero.

The following is the hello-world program from wikipedia.

++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.