MSFE++

From Esolang
Jump to navigation Jump to search

Introduce&Syntax

It is an extended version of MiniStringFuck. Changed from only 2 operators to 3.We also added 2 bytes.Here are three operators in MSFE++.

+ operator: used to add one to the current byte.

- operator: new operator. Subtracts the current byte by 1 and moves to the next byte. If executed at the last byte, moves to the first byte.

Asterisk (*) operator: Iterates through the contents until the byte is 0.

Three minuses will output the current byte. Four will input the current byte.

Examples

Some examples here.

XOR Gate

++-++-+-*-++-+-*+--+-+--+-+-*+++-*

++- is 1, +- is 0. you can change ++-++- to other things.

Cat program

+*----++-++-++-++*

NOT Gate

+-+-+-*+++-*

About the first character: + is 1, delete the + is 0. Result is in the first byte.

Interpreter

And there is an interpreter.

a = [0,0,0]
o = 0
m = 0
def itp(c):
    global a,o,m
    r=0
    for j,i in enumerate(c):
        #print(i,a,o)
        if r==0:
            if i=='+':
                a[o] += 1
                m = 0
            elif i=='-':
                a[o] -= 1
                o += 1
                o = o%3
                m += 1
                if m==3 and (c[j+1]=='-' if j+1<len(c) else 0):
                    a[o]=ord(input()[0])
                if m==3:
                    print(chr(a[o]))
                '''if m==3 and c[j+1]=='-':
                    a[o]=ord(input()[0])'''    
            elif i=='*':
                m=0
                while a[o]!=0:
                    itp(c[j+1:j+1+c[j+1:].index('*')])
        if i=='*':
            r=(r+1)%2
itp('++-++-+-*-++-+-*+--+-+--+-+-*+++-*')#1 XOR 1. Result is in the second byte.
#print(a)

I think it is like BrainFuck,but,It isnt an unary...

smile everyday.