+*-

From Esolang
Jump to navigation Jump to search

+*- (say "add star minus") is an esolang very close to a Minsky machine, it is created by User:None1.

Commands

It had two unbounded accumulators named a and b, both set to zero at start of program.

Command Meaning
+ Increment a
* Swap a and b.
- If a is 0, jump to the start of program, otherwise, decrement a.

Examples

Infinite loop

-

Turing completeness

Though the language is very close to a minsky machine, the author is not good enough at computational theory to prove whether it is Turing complete or not.

See Also

Implementations

Python interpreter with a debug command

c=input();p=a=b=0
while p<len(c):
 if c[p]=="+":a+=1
 elif c[p]=="*":a,b=b,a
 elif c[p]=="-":
  if a:a+=-1
  else:p=0
 elif c[p]=="d":print(a,b)
 p+=1

Javascript (tryit.org version)

function paml() {
 a = b = tv = 0
 while (p<c.length) {
        if (c[p]=="+") { a++ }
   else if (c[p]=="*") { tv=a ; a=b ; b=tv ; tv=0 }
   else if (c[p]=="-") { a-- }
   else if (c[p]=="a") { o += a + " " }
   else if (c[p]=="b") { o += b + " " }
   p++
 }
}