Glanose
Jump to navigation
Jump to search
Gnalose
This is an esolang I made.
Example run:
{>>>>&<<&| |i|s| |t|h|e| |a|n|s|w|e|r| |t|o| |e|v|e|r|y|t|h|i|n|g}+
This should output:
4 2
i s
t h e
a n s w e r
t o
e v e r y t h i n g
What the characters do:
{ allows code to run
} lets code run if it is inside the curly brackets
> adds one to the stack
< takes away one from the stack
| prints character coming after it
& prints length of stack
+ runs code
So that code could have been translated into:
#include <iostream> using namespace std; int main(void) { int stack = 0; stack = 4; cout << stack; stack = 2; cout << stack; cout << ' \ni\ns\n \nt\nh\ne\n \na\ns\nw\ne\nr\n
\nt\no\n \ne\nv\ne\nr\ny\nt\nh\ni\nn\ng'; }
I didn't put it online, so you can't download it or find it anywhere, so just copy the following python code into a python interpreter or software and run it:
chars = []
mem = [0]
init = []
def code(txt):
for i in range(len(txt)):
if txt[i] == '>':
mem[0] += 1
chars.append(':' + str(mem[0]))
elif txt[i] == '<':
mem[0] -= 1
chars.append(':' + str(mem[0]))
elif txt[i] == '|':
chars.append('"' + str(txt[i + 1]))
elif txt[i] == '{':
init.append('r')
elif txt[i] == '}':
init.append('c')
elif txt[i] == '&':
chars.append('"' + str(mem[0]))
elif txt[i] == '+':
if len(init) > 0:
if init[0] == 'r':
if init[len(init) - 1] == 'c':
run()
def run():
for i in range(len(mem)):
mem.pop()
mem.append(0)
for i in range(len(chars)):
if chars[i][0] == ':':
mem[0] = int(chars[i][1:len(chars[i])])
elif chars[i][0] == '"':
print(chars[i][1])
while True:
inpt = input() code(inpt)