My interpreter for Urban Müller's esoteric programming language, Brainfuck, written in Go and Python.
make build && ./bf <fsck'd file>
$ bf.py --help
- Start with thirty thousand bytes/cells initialized with values of zero.
- Track two cursors: position and instruction.
- Ignore everything between balanced brackets if the left bracket exists as the first character on the instruction tape.
- Accept single-key input and output, using ASCII characters.
Instruction | Description |
---|---|
[ |
jump to position after corresponding right bracket, if zero |
] |
jump back to corresponding left bracket, if not zero |
, |
accept one input byte |
. |
output value at the position pointer |
+ |
increment the value at the position pointer (255 rotates to zero) |
- |
decrement the value at the position pointer (0 rotates to 255) |
> |
increment the position pointer (rotate to 0 at tape end) |
< |
decrement the position pointer (rotate to 29999 at tape end) |
## Tests
This repository includes test files. The following string should produce "Hello World!".
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.> ---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.