Uack

From Esolang
Jump to navigation Jump to search

Uack is an esolang made by User:PythonshellDebugwindow.

Memory model

An arbitrary-length stack.

Datatypes

Datatypes are function (which always take an integer as their argument and return an integer) and arbitrary-size unsigned integer.

Syntax

The program is made up of a series of function calls. Where F is a function and X is an integer, then the Python code F(X) would be written like:

XF

But as a special case, the Python code F(G(X)) (where G is also a function) would have to be written like:

FXG

Integers

The only integer available at the start of the program is Z, representing 0; all other integers have to be constructed by the programmer.

Functions

Function Effect
N Nop; return 0
P Return its argument plus one
H Push its argument to the stack; return its argument
O Pop stack, return the popped value
K Peek stack, return the peeked value
T Print its argument with a newline; return its argument
B Break from the outermost function if its argument is zero; return 0 if it broke from the function or 1 otherwise (can change outermost return)

Popping or peeking when the stack is empty returns -1; this is the only way to get a negative integer.

Examples

Push 3 to the stack:

HPZPP

Push 4:

PPZPPH