Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- i=input(">>").split()
- cmd=0;s=[];inp='';o=[]
- while len(i)!=0:
- cmd+=1
- if i[0]=="out":
- if i[1]=="char":
- o.append(chr(int(i.pop(2))))
- i.pop(0);i.pop(0)
- else:o.append(i.pop(1));i.pop(0)
- elif i[0]=="note":i.pop(0);i.pop(0)
- elif i[0]=="in":inp=input("input\n");i.pop(0)
- elif i[0]=="push":
- if i[1]=="in":s.append(inp);i.pop(0);i.pop(0)
- elif i[1]=="out":o.append(s.pop(0));i.pop(0);i.pop(0)
- else:s.append(i.pop(1));i.pop(0)
- elif i[0]=="op":
- if i[1]=="plus":
- s.append(str(int(s.pop(0))+int(s.pop(0))))
- i.pop(0);i.pop(0)
- elif i[0]=="end":print("".join(o));break
- else:print(f"CMD:{cmd} UNDEFINED COMMAND");break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement