Smallfuck

Dialect of programming language Brainfuck

Smallfuck is an even more laconic dialect of Brainfuck, which operates on bits instead of bytes, has limited size of memory tape and has no I/O commands. Thus, it is left with only 5 commands:

  • * : flip the current bit;
  • > : increment the data pointer (move it to the next cell to the right);
  • < : decrement the data pointer (move it to the next cell to the left);
  • [ : “begin loop”: if the current bit is 1, increment the instruction pointer (move it to the next command to the right), otherwise move it to the next command to the right of the matching ] command;
  • ] : “end loop”: if the current bit is 0, increment the instruction pointer, otherwise move it to the next command to the right of the matching [ command. Can also be interpreted as unconditional jump to the matching [ command, since [ performs an extra check itself.

Since no I/O commands are defined, the input is considered to be encoded in the initial state of memory, and the output is decoded from the state of memory after the program execution has ended. The language can be regarded as an automaton to convert memory states; to estimate the program, one has to execute it on all possible input states, or alternatively specify what are the intended input states. The memory tape is limited, so the language is not Turing-complete.

Smallfuck was invented by Nikita Ayzikovsky in 2002. It was intended to be translated into SMETANA code. The language is identical to Boolfuck, except for the lack of I/O commands.