Fruit

From Esolang
Jump to navigation Jump to search

Fruit is esoteric programming language that uses fruits names as commands

Commands

Command Description
Apple Increment
Banana Decrement
Watermelon Output the accumulator as ASCII
Melon Output the accumulator as number
Durian Halt
Cherry Quine
Kiwi Hello, World!
Limon Squaring
| delimiter

Fruit ignores case, so you can write ApPLe, etc.

Interpreter

Python

code = input().lower()
tokens = code.split("|")
acc = 0
for token in tokens:
    if token=="apple":acc+=1
    elif token=="banana":acc-=1
    elif token=="watermelon":print(chr(acc % 256), end="")
    elif token=="melon":print(acc, end="")
    elif token=="durian":break
    elif token=="cherry":print(code)
    elif token=="kiwi":print("Hello, world!")
    elif token=="limon":acc*=acc

Examples

XKCD Random Number

Apple|apple|limon|melon

Hello, world!

Kiwi

Quine

Cherry