From Esolang
Jump to navigation Jump to search

Two is a language invented by User:Tailcalled. It is an uncomputable extension to a Brainfuck dialect, designed to increase the power as much as possible with a single instruction.

Two has nine instructions, eight of which are similar to Brainfuck. The syntax rules are the same as in Brainfuck.

Instruction Description Name
Increment Increments the value pointed to. There is no maximal value. +
Decrement Decrements the value pointed to. The minimum value is 0. Noops if the value is already 0. -
Next Increments the pointer. There is no maximal index. >
Previous Decrements the pointer. There is no minimal index. <
Loop (begin) Loops the body while the value pointed to is not zero. [
Loop (end) ]
Output Outputs the value pointed to as a unicode codepoint if valid; otherwise noops. .
Input Inputs a unicode codepoint and stores it as the value pointed to. Stores zero on EOF. ,
Instruction Intuitively, sets the value pointed to to "infinity". More formally, sets the value so high that increasing it further will not change the behaviour of the program. I

Instruction might seem a bit vague, but can be explained as follows: we say that the effect of a program is its I/O behaviour and whether it terminates. Thus, the effect of the program + is "nothing"; a program consisting of + simply terminates. Instruction will then increase the value pointed to until further increases do not change the effect. If that cannot be done (for example, in the program I[->.<]), Instruction will loop forever.

Instruction has been inspired to adding an "infinite" number to arithmetic by exploiting the compactness theorem.

Computational class

Two is easily able to solve the Halting problem, so it is more powerful than Turing-equivalent languages. The exact power of Two is unknown, but it would not be unreasonable to question its consistency or well-definedness.