Dish
Jump to navigation
Jump to search
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
Dish (or Dead fISH) is a deadfish inspired esolang created by User:Ractangle
Syntax
Command | Action |
---|---|
i | deadfish i command.
|
d | if a!=0, decrement a. Else skip to the next d .
|
s | Push the accumulator to the stack. |
o | deadfish o command.
|
h | Halt program. |
+ | Adds two stack elements together and pushes the result into the stack. |
- | Same as + but does subtraction instead
|
b | Goes to the previous d .
|
u | Gets user input. |
v | Sets the value on the stack and gets popped. |
~ | Discards the top value on the stack. |
Examples
The powers of two
iiidss+vob
Implementations
stack=[] p=a=0 code=input() while len(code)!=p: if code[p]=="i": a+=1 elif code[p]=="d": if a:a+=1 else:p=code.index("d",p+1) elif code[p]=="s": stack.append(a) elif code[p]=="o": print(a) elif code[p]=="h": break elif code[p]=="+": stack.append(stack.pop()+stack.pop()) elif code[p]=="-": stack.append(stack.pop()-stack.pop()) elif code[p]=="b": p=code.index("d",0,p-1) elif code[p]=="u": stack.append(int(input())) elif code[p]=="v": a=stack.pop() elif code[p]=="~": stack.pop() p+=1