esolang

FuckPack

Brainfuck with four more commands, and one of them lets a cell say where the pointer goes.

2018 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: A

The idea

FuckPack is brainfuck with a pointer jump, a multiply, a left shift and a bitwise not. The specification gives a Common Lisp interpreter, in which cells are integers without bounds and the pointer may go below 0.

Read the story

J moves the pointer to the cell numbered by the current cell, so a value can serve as an address. The cat uses that as a lookup table. It fills cell i with i for every i from 0 to 255, with 255 >, 255 + and then 255 times <+*-. Then it reads a character, jumps to the cell with that number and prints it.

The machine

CommandDoes
+ - < > [ ] . ,As in brainfuck
JMove the pointer to the cell numbered by the current cell
*Multiply the current cell by the next one
}Shift the current cell one bit left
XInvert its low bits, as many as it has but at least 8

Every other character does nothing.

Example

The first is the specification's.
Expected: A

The first is the specification's. 1 shifted left six times is 64, and one more + makes 65. The second multiplies 8 by 8.

The other A counts to 190 and inverts it. 190 is 10111110 in binary, and inverted that is 01000001, which is 65.

Expected: A

Patterns it teaches

Further

FuckPack builds on Brainfuck.

Brainfuck derivatives

Cell-based

Write your own in Run Convert a program from FuckPack

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: fuckpack.

Command line

shib run fuckpack -e '+}}}}}}+ .'
shib manual fuckpack

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/fuckpack.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org