Mel
Jump to navigation
Jump to search
Mel (Minsky machine equivalent language) is an esolang invented by User:None1.
Commands
Every line is a command:
+++...+<accumulator name>
Increases the accumulator by the number of +
's.
For example:
+++A
Adds A by 3.
---...-<accumulator name>
If accumulator is not zero, decrement the accumulator, otherwise jump to line x, where x is the number of -
's (1-indexed).
For example:
---B
Decrements B if it's nonzero, otherwise jumps to line 3.
There are two accumulators: A and B, they are both unbounded. Programs are case-insensitive.
Translation from minsky machine
It can be easily translated, for example, this minsky machine program, in Szewczyk notation for Minsky machine notation:
1 -1 1 1 1 1
Can be translated to:
+A -A -A
So, it is Turing complete.
Interpreter in Python
import sys c=sys.stdin.read().lower().strip().split('\n') ip=0 acc=[0,0] while ip<len(c): cmd=c[ip] idx=(0 if cmd[-1]=='a' else 1) if cmd[0]=='+': ip+=1 acc[idx]+=len(cmd)-1 else: if acc[idx]: acc[idx]-=1 ip+=1 else: ip=len(cmd)-2 # print('a={} b={}'.format(*acc))