Boolfuck
Jump to navigation
Jump to search
Boolfuck is an esoteric programming language based on Brainfuck, but operating only on bits. It does, however, provide input and output.
Commands
Command | Meaning |
---|---|
+ |
Invert the bit that the current tape cell holds. |
, |
Input. |
; |
Output. |
< |
Move tape head left. |
> |
Move tape head right. |
[ |
Jump past matching ] if current tape cell holds 0.
|
] |
Jump back to matching [ .
|
Computational class
Boolfuck can be shown to be Turing-complete by reduction from Brainfuck. Each Brainfuck program maps to a Boolfuck program - so anything that can be expressed in Brainfuck can also be expressed in Boolfuck - and Brainfuck is known to be Turing-complete. More details on the reduction can be found at the Boolfuck website, listed below.
Differences from Brainfuck
- Works with bits not bytes. Each cell is 1-bit and wrapping, so
-
is removed. - The output character is
;
not.
. - The input is read in little endian mode and reads a single bit at a time.
- Output is stored to a stream, then outputted in little endian mode.
Examples
Here is a sample Boolfuck program; it outputs Hello, world!:
;;;+;+;;+;+; +;+;+;+;;+;;+; ;;+;;+;+;;+; ;;+;;+;+;;+; +;;;;+;+;;+; ;;+;;+;+;+;; ;;;;;+;+;; +;;;+;+;;;+; +;;;;+;+;;+; ;+;+;;+;;;+; ;;+;;+;+;;+; ;;+;+;;+;;+; +;+;;;;+;+;; ;+;+;+;
See also
Other languages operating on bits (implemented only):