We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
UniGolf
- This is still a work in progress. It may be changed in the future.
| Designed by | {{{author}}} |
|---|---|
| Appeared in | 2026 |
| Memory system | Stack-based |
| Computational class | Unknown |
| Reference implementation | Unimplemented |
| Influenced by | EternalGolf, GolfScript |
UniGolf is a user edited language. the rules are:
- Your edit mustn't be a joke.
- UniGolf must remain implementable and computable after your edit.
- UniGolf must benefit from your edit.
Spec
Overview
UniGolf has infinite stacks. Literals are pushed onto the stack whenever they are executed. There are also boxes, which can hold values.
Datatypes
- Nil - Nothing.
- Boolean - just a True or False.
- Number - A complex number made out of 2 components, the real one, and the imaginary one. each component shall be represented either as an arbitrary length integer, or a float, depending on whether the component is an integer or not.
- Table - A set of key-value pairs.
- Array - A subset of a table whose indices are from 1 to infinity, with no gaps.
- String - An array of integers from 0 to 255. Encoded in UTF-8.
- Array - A subset of a table whose indices are from 1 to infinity, with no gaps.
- Function - A block of code.
Booleans
T for true and F for false.
Numbers
Numbers are written in decimal, but each number must use only one of these rows as the digits:
0123456789 ABCDEFGHIJ
The reason there are 2 of them, is such that you can write one number after another without the need for a separator. For complex numbers, you can use 123j456 to get a value of 123+456i pushed onto the stack.
Strings
Strings are made by just enclosing your text in quotation marks (""). putting \n puts a newline into there. ЧX is a string containing X because Ч turns the following character into a length 1 string.
Tables
Tables are made by putting keys and values consecutively inside of 2 backslashes, for example \ЧaЧbЧcЧd\ would make a table with the key "a" holding the value "b" and the key "c" holding the value "d" or by using the ◆ command.
Arrays
Arrays are made by putting all your values in []. alternatively, you can use the ◇ command.
Functions
Functions can be made by putting some code inside {}.
The stacks
As said in the overview section, this language has infinite stacks. Whenever the specification says "the stack" it is talking about the current stack. There exists an imaginary table, which holds all of the stacks, however, you may only access one at a time. to switch between them, you can use the ↔ command. The interpreter starts off at the stack keyed 1. Popping the bottom of the stack gives a Nil value
Boxes
Boxes are just variables. You can make one by typing a sequence of these characters:
🄰🄱🄲🄳🄴🄵🄶🄷🄸🄹🄺🄻🄼🄽🄾🄿🅀🅁🅂🅃🅄🅅🅆🅇🅈🅉
| Syntax | Description |
|---|---|
| ~🅅🄰🅁 | Pops a value off the stack and puts it in the box. |
| 🅅🄰🅁 | Pushes the value of the box onto the stack. |
Coercion rules
Coercion is always allowed.
| From | ||||||||
|---|---|---|---|---|---|---|---|---|
| Number | Boolean | String | Table | Array | Function | Nil | ||
| To | Number | x?1:0 | TODO: make this well defined | c=0;for(k,v in x){c++}return c | length(x) | Runs the function every time this value is to be used and uses the new top of the stack as the value | 0 | |
| Boolean | x>0 | x!="" | x!=\\ | x!=[] | F | |||
| String | TODO: make this well defined | x?"T":"F" | "" | |||||
| Table | TODO | TODO | \\ | |||||
| Array | [x] | [x] | [] | |||||
| Function | function which pushes the value onto the stack | function which pushes the value onto the stack | Parse text as a UniGolf program and make it into a function | function which is just ← but the table is the one youre coercing from | See left | No-op function | ||
| Nil | Nil | Nil | Nil | Nil | Nil | Nil | ||
Built-in variables
| Symbol | Value |
|---|---|
| ∞ | Infinity. |
| π | The ratio of the circumference of the circle to the diameter of the circle. |
Commands
This section will explain all the commands in this esolang. Command inputs are popped in the order they are written in the table's inputs/outputs column, meaning if a command CMD takes A and B, the stack before the operation will look as such:
A B
and therefore, the program which will run the command with A and B, will look like <B><A><CMD>
| Symbol | inputs and outputs | Description |
|---|---|---|
|
NOP. | |
; |
any | Does nothing, AKA pop command. |
_ |
any -> any, any | Pushes 2 any, AKA duplication command. |
+ |
num, num -> num | Adds the 2 numbers together and pushes the result. |
- |
num, num -> num | Subtracts the first number from the second and pushes the result. |
* |
num, num -> num | Multiplies the 2 numbers together and pushes the result. |
/ |
num, num -> num | Calculates the first number over the second and pushes the result. |
% |
num, num -> num | Calculates second number modulo first number and pushes the result. |
` |
array, array -> array | Appends all elements of the second array to the first. For example "abc""def"` would produce a string equivalent to the string "abcdef". All non-array keys from the first array are untouched |
= |
any, any -> boolean | If the 2 inputs are equal, push true, otherwise push false. |
≈ |
any, any -> boolean | Convert the first value to the second's type, if the 2 values are equal, push true, otherwise push false |
> |
num, num -> boolean | If the second number is bigger than the first one, push true, otherwise push false. |
< |
num, num -> boolean | If the second number is smaller than the first one, push true, otherwise push false. |
@ |
function | calls the function. |
? |
function, function, boolean | if the boolean is true, then the first function will be executed, otherwise the second one will be executed. |
✇ |
function, num | calls the function number times. |
⚛ |
function, function | execute the second function, pop a boolean off the stack and if it is true then execute the first function, and repeat until the boolean is no longer true. |
➫ |
function, table | Pushes a value from the table, runs the function, and repeats until all the values of the table were used. The order is numerical for the numeric indices and undefined for the rest, starts with the numeric indices. |
↺ |
function | Calls the function forever. |
¦ |
Exits out of a function, like a continue keyword for loops. | |
Ꝇ |
Halts the program. | |
O |
str | Prints the string. |
ᐛ |
Prints a newline. | |
i |
-> str | Gets one byte of input and pushes it onto the stack. |
I |
-> str | Gets one line of input and pushes it onto the stack. |
Î |
-> num | Gets one line of input, coerces it to a number and pushes it onto the stack. |
Ï |
-> str | Gets one file of input and pushes it onto the stack. |
🔢 |
num -> num | Pushes num onto the stack. |
◆ |
any* -> table | (e.g. 3B7C◆ will produce a table of 3=1 and 7=2)
|
◇ |
any* -> array | Makes an array of all the elements of the stack from the bottom to the top and pushes it . |
🇺🇸 |
any* | Shoots all the values in the current stack using a bald eagle and kills them. |
↔ |
any | Switches to the stack with the index of the popped value. |
← |
any, table -> any | Indexes into the table with the var and pushes the result. Nil if the key doesnt exist |
→ |
any, any, table -> table | Indexes into the table with the second variable and sets that key to be equal to the first value. |
Examples
4O
"Hello, world!"O
{}↺
{ÏO}↺
ÎÎ+O
0{O1+" "O}↺
0Î={{1O}↺}{0O}?
1{_15%0={_5%0={_3%0={_}{"Fizz"}?}{"Buzz"}?}{"FizzBuzz"}?Oᐛ1+}↺
99_{_O" bottles of beer on the wall,"Oᐛ_O" bottles of beer.\nTake one down, pass it around,"Oᐛ1-_O"bottles of beer on the wall."Oᐛᐛ}✇
4-function calculator with an explanation
ÎÎi_Ч+={_Ч*={Ч-={/}{-}?}{;*}?}{;+}?O
ÎÎ Input 2 numbers and push them onto the stack.
i Input a character and push it onto the stack, this will be the operator.
_Ч+= Duplicate the operator string on the symbol such that the = wont consume the original one, push the string of "+" onto the stack and check if its equal to the operator we just duplicated.
{ [...] }{;+}?O If it is equal, then we pop the operator and sum the 2 numbers we got at the start and output, otherwise run the [...] stuff.
_Ч*={ [...] }{;*}? O If the operator is *, then pop and multiply the 2 number, then output, otherwise run the [...] stuff.
Ч-={/}{-}? O This time we dont need to duplicate the operator because we arent gonna use it again, nor do we have to pop it now, since the = eats it anyway.
requests 2 numbers and one of these operations: + - * /