Interpreters interpreters

Esoteric language interpreters — execute Brainfuck and Ook programs, or translate between them
Pixelbadger Toolkit — pbtk interpreters← all topics

brainfuck

Executes a Brainfuck program read from a file. Brainfuck is a Turing-complete esoteric language with only eight instructions that operate on a tape of 30,000 byte cells.

$ pbtk interpreters brainfuck --file hello.bf
flowchart LR F["hello.bf\nBrainfuck source"] --> PARSE["Read program text"] PARSE --> EXEC["Execute on\n30,000-byte tape"] EXEC --> OUT(["stdout: program output"])

Instruction Set

>

Move data pointer right one cell.

<

Move data pointer left one cell.

+

Increment the current cell by 1 (wraps at 255).

-

Decrement the current cell by 1 (wraps at 0).

.

Output the current cell as an ASCII character.

,

Read one character from stdin into the current cell.

[

If the current cell is 0, jump forward to the matching ].

]

If the current cell is non-zero, jump back to the matching [.

All characters other than > < + - . , [ ] are treated as comments and ignored. The tape is 30,000 bytes, all initialised to zero.
OptionRequiredDescription
--fileYesPath to the Brainfuck program file (.bf)

ook

Executes an Ook! program read from a file. Ook! is a joke language invented by David Morgan-Mar that is semantically identical to Brainfuck but uses only the word "Ook" combined with punctuation. Each instruction is a two-token pair.

$ pbtk interpreters ook --file hello.ook

Instruction Mapping

Ook. Ook?
→ >

Move pointer right.

Ook? Ook.
→ <

Move pointer left.

Ook. Ook.
→ +

Increment current cell.

Ook! Ook!
→ -

Decrement current cell.

Ook! Ook.
→ .

Output current cell as ASCII.

Ook. Ook!
→ ,

Read character into current cell.

Ook! Ook?
→ [

Jump forward if cell is zero.

Ook? Ook!
→ ]

Jump back if cell is non-zero.

OptionRequiredDescription
--fileYesPath to the Ook program file (.ook)

bf-to-ook

Translates a Brainfuck source file into equivalent Ook! source and writes the output to a file. The conversion is a straightforward one-to-one token substitution — every Brainfuck instruction becomes its two-token Ook! equivalent separated by a space.

$ pbtk interpreters bf-to-ook --source hello.bf --output hello.ook
flowchart LR BF["hello.bf\n><+-.,[]"] --> MAP["One-to-one\ninstruction substitution"] MAP --> OOK["hello.ook\nOok. Ook? Ook? Ook. ..."]
Non-instruction characters (comments) in the Brainfuck source are silently dropped — the output Ook file contains only valid Ook tokens.
OptionRequiredDescription
--sourceYesPath to the source Brainfuck file to translate
--outputYesPath to write the generated Ook file

Command Reference

Command Required options Optional options Output
interpreters brainfuck --file Program output to stdout
interpreters ook --file Program output to stdout
interpreters bf-to-ook --source --output Ook source written to --output