Boolshit

From Esolang
Jump to navigation Jump to search
Boolshit
Paradigm(s) Imperative
Designed by User:Hakerh400
Appeared in 2020
Computational class Uncomputable
Major implementations Unimplemented
File extension(s) .txt


Boolshit is a Boolfuck derivative that does not have any I/O instructions, but can still perform I/O operations.

Memory

Memory is an unbounded tape of bits. Only positive addresses (cells) can be accessed. Performing < when the memory pointer is 0 throws an error.

Commands

Command Description
< Move the pointer to the left
> Move the pointer to the right
~ Flip the memory bit at the pointer
[ Jump past the matching ] if the cell at the pointer is zero
] Jump back to the matching [ if the cell at the pointer is nonzero

I/O

Input and output are strings of bits. We define the process of escaping a string of bits: given an unescaped string of bits, to escape it prepend a single 1 bit before each bit of the string and then append a single 0 bit. The process of unescaping a string of bits is simply a reverse of escaping: given an escaped string of bits, you extract bits from the odd positions (0-indexed) and concatenate them. Note that all escaped strings are prefix-free (no escaped string is a prefix of another escaped string).

At any point during the program execution, let be the maximal number such that the memory cells will not be modified anymore by the program. We interpret the values of those cells as an array of escaped strings (and if there are not enough bits in the last string to unescape it properly (the th cell has value 1), then ignore it). Then do the following:

  • If the input is empty, output the first string among those and halt the program
  • If the input is 0, then output the 2nd string and halt the program
  • If the input is 1, then output the 3rd string and halt the program
  • If the input is 00, then output the 4th string and halt the program
  • If the input is 10, then output the 5th string and halt the program
  • If the input is 01, then output the 6th string and halt the program
  • If the input is 11, then output the 7th string and halt the program
  • If the input is 000, then output the 8th string and halt the program
  • If the input is 100, then output the 9th string and halt the program
  • If the input is 010, then output the 10th string and halt the program
  • And so on ...

Before we output a string, we implicitly unescape it. If there are not enough escaped strings (for example, the input is 01 and we can safely extract only four strings), then let the program execute one more step.