- The title of this article is incorrect because of technical limitations. The correct title is <stack>.
|Computational class||Push-down automata|
<stack> is an esolang created by User:None1. It's very brainfuck-like. However, it's not Turing complete.
There are only 7 valid opcodes in <stack>, which are <,s,t,a,c,k,and >, other characters are ignored. <stack> is case sensitive.
Just like its name, <stack> is stack-based, and the stack contains only 8-bit integers (bytes).
In the beginning, there is an initial 0 in the stack, and each opcode does something to the stack:
< If the the top of the stack is zero, move to the matching >, otherwise just move to the next character.
s Pushes a 0 into the stack.
t Reads a character from the standard input, and pushes its ASCII value into the stack.
a Adds 1 to the top of the stack, when the result is 256, it becomes 0 to fit in a byte.
c Print the top of the stack to standard output as a character, then pop it, does nothing if the stack contains less then 2 elements.
k Pops from the stack once, does nothing if the stack contains less then 2 elements.
> If the top of the stack is not zero, move to the matching <, otherwise just move to the next character.
It's obvious that the stack NEVER becomes empty.
Translate to Brainfuck
Any <stack> code can be translated to Brainfuck using the table below, but the opposite is not true.
<stack> Brainfuck (begin) >+> < <<[>> s >> t ,>> a <<+>> c >+<-<-[>+<<.[-]->>]-[+>-]+<<+>>[->+] k <[>>]< > <<]>>
Hello World program (very long!):
saaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacsaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa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aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa>k<aaaaaaaaaac>
Reads text, prints <stack> code that prints it:
a<saaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaact<aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaac>aaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaac>
The name of this language is also considered an example program, which does nothing.
Existence of a quine
Does <stack> have a non-empty quine? The answer is probably no, but I (User:None1) can't prove it.
The content here should be changed if someone proves that a <stack> quine exists or not.
- An interpreter in C++, written by the creator of this language (User:None1). as Windows executable (64 bit)
- <stack> playground, where you can run <stack> code directly online.