Hum

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

Hum is a golf esolang made by User:Ractangle during his IT lesson becuase he didn't want to make a very complicated project (A.K.A. Making a sims game in python)

Commands

Command Meaning
# Starts the program
`...` Pushes every symbol surrounded by ` to string stack
@ Prints the top value on the stack
> Moves contents from the string stack to the stack
! Pops the top value on the (string) stack
R Flips the (string) stack
M Changes the stack pointers position
|...| Comment
_ Takes one element from the input

Examples

Hello, world!

#`Hello, world!`>@

Interpriter

A Python interpriter made by the creator of this esolang.

m="";s=[];ss=[];os=[];sp=0;inp=[]
def code(i,u):
    global m,sp
    for t in u:
        inp.append(t)
    for c in i:
        if c=="`" and m=="c":m="s"
        elif c=="`" and m=="s":m="c"
        elif m=="s":ss.append(c)
        elif c=="@" and m=="c":s.reverse();os.append(s[0]);s.reverse();s.pop()
        elif c==">" and m=="c":
            while len(ss)>1:a=str(ss[0])+str(ss[1]);ss.pop(0);ss.pop(0);ss.reverse();ss.append(a);ss.reverse()
            while len(ss)>0:s.append(ss[0]);ss.pop(0)
        elif c=="#":m="c"
        elif c=="!" and sp==0:ss.pop()
        elif c=="!" and sp==1:s.pop()
        elif c=="R" and sp==0:ss.reverse()
        elif c=="R" and sp==1:s.reverse()
        elif c=="M" and sp==0:sp=1
        elif c=="M" and sp==1:sp=0
        elif c=="|":m=="no"
        elif c=="|" and m=="no":m==c
        elif c=="_" and m=="c":s.append(inp[0]);inp.pop(0)
    print(f"code:\n{i}\nstring stack:\n{ss}\nstack:\n{s}\ninput:\n{u}\noutput:")
    while len(os)>0:print(os[0]);os.pop(0)
code("code","input")

The IT teachers response

Круто (Cool)