Path (Ractangle)

From Esolang
Jump to navigation Jump to search
For other languages named Path, see Path.

Path is an esolang created by User:Ractangle where multiple brackets are used as a part of a code

Syntax

(...) pushes the length of the contents surrounded by curly brackets
[...] comments
<...> manages the program execution state
{...} execute a part of a program
+ Adds two elements on the stack together 

Implementation

Implementation created by the creator

m="";s=[];l=[]
def code(i):
  global m
  for c in i:
    if c=="<":m="Y"
    elif c==">":break
    elif c=="(" and m=="Y":m="a"
    elif c==")" and m=="a":
      m="Y"
      s.append(len(l))
      while len(l)>0:l.pop()
    elif m=="a":l.append(c)
    elif c=="[" and m=="Y":m="i"
    elif c=="]" and m=="i":m="Y"
    elif m=="i":print(end="")
    elif c=="{" and m=="Y":m="c"
    elif c=="}" and m=="c":m="Y"
    elif c=="+" and m=="c":a=int(s[0])+int(s[1]);s.reverse();s.pop(0);s.pop(0);s.append(a);s.reverse()
    else:print("UNKNOWN COMMAND. HALT");break
  print(f"stack:{s}")
code("")