111

From Esolang
Jump to navigation Jump to search

111 is a /// derivative based on length-prefixed binary strings.

Semantics

A program is a list of bits. A string consists of any number of 1 bits (including zero), followed by a 0, followed by as many bits as there were 1s. For example, 1110010 consists of the length (111 in unary, aka 3), a 0 bit to delimit the length and the contents, and then the bits 010, whereas 0 is the empty string. A substitution consists of two strings, the source and destination, concatenated together; for instance, 110001110101 (read as 11 0 00 111 0 101) is a substitution with the source 00 and the destination 101. Substitution proceeds as in ///. The only possible output is whether the program halts or not, though implementations are encouraged to print the program as it evolves.

The behaviour when there are not enough bits in the program to read in a complete string or substitution shall be defined by the first person who manages to actually write a program that computes something with any reasonable interpretation of that case, but halting as /// does is likely to be the cleanest option.

External resources