From Esolang
Jump to navigation Jump to search

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.


Command Description
0 Increments instruction pointer by 1
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:

Order of the PocketBF command selector
Current PocketBF command = + > | ;
Next PocketBF command + > | ; =


Cat Program

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.


I think it is more efficient to iterate through PocketBF's instructions that Brainfuck's or TinyBF's, but I will have to test to see if there is a better language to have the pointer point to.


Cat program

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.