InstructionPointerBF is a PocketBF variant. There are only 2 instructions, so it can take instruction in binary. The motivation for creating InstructionPointerBF is to allow Brainfuck code to compressed by converting characters to InstructionPointerBF, so that no ASCII character is wasted.
||Increments instruction pointer by 1|
||Executes instruction at pointer as PocketBF code|
A PocketBF command selector, starting at the instruction
=, selects upon each encounter with a zero-bit (
0) the next command, following this ordering:
= + > | ;
Having reached the desinent member (
;), the selector wraps around, starting again with
A description of these instructions can be found in the article here.
A more explicit illustration of the command selector's advance shall be provided below:
|Current PocketBF command||
|Next PocketBF command||
01001010 10000100 00100000
On the last line, 5 zeros had to be padded to make a complete byte.
While slightly inefficient, a Cat program is only 3 bytes, compared to Brainfuck's 5 bytes. If the "junk bits" are removed, a Cat program is only 19 bits, compared to Brainfuck's 40. So significant compression has been achieved.
In the following is an infinitely repeating cat program implemented:
- Common Lisp implementation of the InstructionPointerBF programming language. The program also contains a PocketBF interpreter, given their consanguinity.