Triple-U

From Esolang
Jump to navigation Jump to search

Triple-U is a programming language which uses only three characters: u, w (double u) and ꪛ (triple u).

Overview

Triple-U operates on an infinite tape of data strings, each starting empty.

There is also a pointer which can access any data string on the tape, as well as a "hold string" for temporary storage.

The following instructions are available:
Instruction What it does
uuX X can be any of three characters mentioned above. Append X to the current data string.
uwu Delete one character from the end of the current data string.
uww Clear the current data string.
wuu Move the pointer to the left.
wuw Move the pointer to the right.
wwu While the current data string does not end in ꪛ...
uwu End while.
ꪛuu Set the hold string to the current string.
ꪛuw Replace the current string with the hold string.

I/O instructions

Instruction What it does
ꪛwu Input an integer and append a ꪛ followed by its binary representation (u for 0, w for 1) to the current string.
If 0 is input, do not append anything.
ꪛww Input an character and append a ꪛ followed by the binary representation of its codepoint (u for 0, w for 1) to the current string.
If 0 is input, do not append anything.
ꪛuꪛ Input a float and separate it into an integer and the number of digits after he decimal point.
For example, 6.02 becomes 602, 2.
And append a ꪛ, the binary representation of the first number, (u for 0, w for 1),
another ꪛ and the binary representation of the second number to the current string.
If 0 is input, do not append anything.
ꪛwꪛ Parse the section of the current string after the last ꪛ as a binary number and output as a decimal integer.
ꪛꪛu Parse the section of the current string after the last ꪛ as a binary number and output the corresponding character.
ꪛꪛw Parse the section of the current string after the penultimate ꪛ as two ꪛ-separated binary numbers (X followed by Y) and output X * 10-Y as a float.

The instruction ꪛꪛꪛ is undefined behavior.