猫史档案馆


我编的supta编程语言,可以解析.sup文件里的代码,使用方法自己看代码

用户:TimeLinkForeverTimeLinkForever查看:1 回复:1 评论:1 创建时间:2020-01-13T21:32:19


emotion_编程猫_搓头

#coding:utf-8
print('欢迎来到由时之笛林克编写的Supta v0.0.7编程语言。可以对我进行编程。')
A=0
B=0
C=0
D=0
E=0
F=0
G=0
H=0
I=0
J=0
K=0
L=0
M=0
N=0
O,P,Q,R,S,T=0,0,0,0,0,0
U,V,W,X,Y,Z=0,0,0,0,0,0
Varilist="A B C D E F G H I J K L M N O P Q R S T U V W X Y Z".split()
Varibles=[A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]


def understand(code):
    codes=code.split()
    try:
        if (codes[0] == "say"):
            if (codes[1]=="me"):
                try:
                    print(codes[2])
                except:
                    print("INPUTERROR")
                    print()
                    print("Don't press space in the input!")
                
        if (codes[0]=="var"):
            try:
                Varibles[int(codes[1])-1] = int(codes[2])
            except:
                print("INPUTERROR")
                print()
                print("Inputer needs int type")
        if (codes[0] == "sayvar"):
            if (codes[1] == "me"):
                my=int(codes[2])-1
            
                print(Varibles[my])
        if (codes[0] == "picko"):
            try:
                a = ""
                if (codes[1] == "choice"):
                    import random
                    choices = codes[2].split(",")
                    a = random.choice(choices)
                elif (codes[1] == "num"):
                    import random
                    choices = codes[2].split(",")
                    
                    
                    a = random.randint(int(choices[0]), int(choices[1]))
                if (codes[3] == "say"):
                    print(a)
                elif(codes[3] == "var"):
                    Varibles[int(codes[4]-1)]=int(codes[5])
            except:
                print("ERROR")

                

    except:
        print("SYNTAXERROR")
        print()
        print("IVALID SYNTAX")



            

for a in [0,1]:#try:
    a = int(input('进行交互模式(输入1)或打开文件(输入2)。'))
    if (a == 1):
        print('现在进入交互面板,如需进入文件面板,请再次进入Supta')
        while True:
            code=input("ENTER YOUR CODE>>>")
            understand(code)
    elif (a == 2):
        print("请上传文件")
        filename=input("写下来名字吧")
        file=0
        with open(filename,encoding="utf-8") as safile:
            file=safile.readlines()
        
        for code in file:
            understand(code)
#except :
    #print("代码被错误终止,请键入正确的答案")


回复

上一页1 页 / 共 1下一页
TimeLinkForeverTimeLinkForever

©CopyRight 时之笛林克 版权所有

点赞1


评论