InstructionPointerBF
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 |
Instructions: "=+>|;". Loops around. Description of instruction can be found here.
Examples
Cat Program
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.
Note:
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.