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.
Nilad
Nilad is an esolang invented by User:None1, it is a derivative of Minsky Machine where commands take no arguments.
Name of the language
The name Nilad comes from the documentation of Brain-Flak where the word means "functions that take 0 arguments".
Memory
There are three unbounded accumulators: A, B and J. They're initialized to 0.
Commands
There are 6 mandatory commands and one optional command:
| Command | Meaning |
|---|---|
| + | Increment A |
| - | Decrement A |
| : | Add J by 1 |
| ; | Add J by 10 |
| % | Jump to the J'th character (0-indexed) if A is 0. Then, set J to 0. |
| ~ | Swap A and B |
| . (optional) | Print A either as integer or character. |
Examples
XKCD Random Number
++++.
Infinite loop
%
Truth Machine
.;%-+.:::::-%
This is the zero input program, add a + before code to get the one input program.
Computational class
It's Turing-complete as it can be translated from a 2-register Minsky Machine. One can access both A and B using the ~ command, and use + and - to operate on them. Jumps can be done by setting J to an appropriate value and jump using the % command.
Minimalizations
Minimalized Nilad
Minimalized Nilad is a dialect which has 5 commands but still TC.
| Command | Meaning |
|---|---|
| + | Increment A. Swap A and B. |
| - | Decrement A. Swap A and B. |
| : | Multiply J by 2. Swap A and B. |
| ; | Multiply J by 2. Add A by 1. Swap A and B. |
| % | Jump to the J'th character (0-indexed) if A is 0. Then, set J to 0. |
The author wonders if this esolang can be minimalized further (but still TC). You can try minimalizing it!
User:I am islptng's attempt
4 commands:
| Command | Meaning |
|---|---|
| + | Increment A. Swap A and B. |
| - | Decrement A. If A is already zero, jump J character. Then set J to 0. |
| : | Multiply J by 3. Decrement J. Swap A and B. |
| ; | Increment J. |
Implementations
Interpreter for both dialects by the author:
def nilad(code):
ip=a=b=j=0
while ip<len(code):
c=code[ip]
if c=='+':
a+=1
elif c=='-':
a-=1
elif c==':':
j+=1
elif c==';':
j+=10
elif c=='%':
if not a:
ip=j-1
j=0
elif c=='~':
a,b=b,a
elif c=='.': # optional
print(a)
ip+=1
def mnilad(code): # Minimalized Nilad
ip=a=b=j=0
while ip<len(code):
c=code[ip]
if c=='+':
a+=1
a,b=b,a
elif c=='-':
a-=1
a,b=b,a
elif c==':':
j*=2
a,b=b,a
elif c==';':
j=j*2+1
a,b=b,a
elif c=='%':
if not a:
ip=j-1
j=0
ip+=1
nilad('<CODE HERE>')