load
load is yet another 4-instruction esolang invented by User:None1, this time a real Turing tarpit.
Memory
Seven accumulators: A-G are used. They contain unbounded signed integers. At first, A is 1 and others are 0.
Commands
load has the following 4 commands (case sensitive).
| Command | Meaning |
|---|---|
l |
Bitwise left shift A by 1 bit and store the result into B. Then, cyclic shift all three accumulators (A,B,C=B,C,A). |
o |
Bitwise not A and store the result into B. Then, cyclic shift all 7 accumulators (A,B,C,D,E,F,G=B,C,D,E,F,G,A). |
a |
Bitwise and A and B and store the result into B. Then, cyclic shift all 7 accumulators. |
d |
Do nothing. Then, cyclic shift all 7 accumulators. |
After the last command is executed, execution goes back to the first. Invalid commands raise an error.
As there's no output, the interpreter may choose to print debugging information.
Examples
Powers of 2
l
After each operation, the result is stored in the accumulator A.
Cellular automaton rule 110
lldddddddooodddoooaodlldddddaaoooa
After each cycle, the result (every line of rule 110 interpreted as a binary number) is stored in the accumulator A.
Author's draft on the program:
llddddd A B C ? ? ? ? A B C ~C C ~C ? ddooodd A B ~B B ~B ~C ? doooaod A B ~B B ~B ~B&~C ? A B ~B B ~B ~B&~C ~(~B&~C) A B ~B B ~B ~B&~C ~(~B&~C) llddddd A B C B ~B ~B&~C ~(~B&~C) aaoooa A A&B A&B&C ~(A&B&C) A&B&C ~(A&B&C) ~(A&B&C)&~(~B&~C)
Interpreter in Python
from time import *
c = input()
A, B, C, D, E, F, G = 1, 0, 0, 0, 0, 0, 0
while 1:
for i in c:
if i == "o":
B = ~A
elif i == "a":
B &= A
elif i == "l":
B = A << 1
elif i == "d":
pass
else:
raise SyntaxError(f"Invalid command: {i}")
A, B, C, D, E, F, G = B, C, D, E, F, G, A
sleep(0.2)
print(f"Executed command {i}: A={A} B={B} C={C} D={D} E={E} F={F} G={G}")
print("=" * 10)
Computational class
As you see, load can implement cellular automaton rule 110 which is Turing-complete. Therefore, load is Turing-complete as well. In addition, because load has only 4 commands, it is also a Turing tarpit.