hsifdaeD

From Esolang
Jump to navigation Jump to search

hsifdaeD is an esolang by User:None1, it can do nothing but interpret Deadfish.

Data storage

It has an accumulator.

Commands

Any program in this esolang must have exactly 5 characters, or a syntax error is raised.

Command Meaning
, Read a character from user input, jump to character 2-5 respectively if the input is i, d, s and o, otherwise just quit
i Increment accumulator and jump to the start of program
d Decrement accumulator and jump to the start of program
s Square accumulator and jump to the start of program
o Output accumulator and jump to the start of program

Examples

Deadfish interpreter

,idso

Interpreter

Python =

from sys import exit
check_acc = False # change to True to change accumulator to 0 if it equals -1 or 256
a = 0
s = input()
if len(s) != 5:
    print("ERROR!")
    exit()
else:
    ip = 0
    jmpt = {
        "i": 1,
        "d": 2,
        "s": 3, 
        "o": 4
    }
    while ip < len(s):
        c = s[ip]
        if c == ",":
            ip = jmpt[input()[0]] # takes only first string of character input
        elif c == "i":
            a += 1
            ip = 0
        elif c == "d":
            a -= 1
            ip = 0
        elif c == "s":
            a *= a
            ip = 0
        elif c == "o":
            print(a)
            ip = 0
        if (check_acc and (a == -1 or a == 256)): a = 0