U (Ractangle)

From Esolang
Jump to navigation Jump to search

U is an esoteric programming language created by User:Ractangle based on mostly bf

Syntax

Commands

CMD ACTION
>   Move the cell pointer right
<   Move the cell pointer left
:   Duplicate the cureent cell's value to the cell next to it
+   Increment the current cell
-   Decrement the current cell
.   Output the current cell's value as an ASCII charecter
,   Output the current cell's value as an Interger
*   Multiplyies the two cells together
/   Divides the two cells togeteher
s   Sum of the two cells
d   Difrence of the two cells
?   Prints the cells and the current position of the pointer

Implementation

"this was made a really while ago. managed to find it using the \"Everything\" tool"
#CMD ACTION
#>   Move the cell pointer right
#<   Move the cell pointer left
#:   Duplicate the cureent cell's value to the cell next to it
#+   Increment the current cell
#-   Decrement the current cell
#.   Output the current cell's value as an ASCII charecter
#,   Output the current cell's value as an Interger
#;   Creates a newline in the code
#*   Multiplyies the two cells together
#/   Divides the two cells togeteher
#s   Sum of the two cells
#d   Difrence of the two cells
#?   Prints the cells
c,a,ce,p,t=[],0,[0]*5,0,0;print("py-U")
for i in input("code:"):c.append(i)
print(c)
while len(c)>0:
  if c[0]==">":p+=1;c.pop(0)
  elif c[0]=="<":p-=1;c.pop(0)
  elif c[0]==":":t=ce[p];p+=1;ce[p]=t;p-=1;c.pop(0)
  elif c[0]=="+":ce[p]+=1;c.pop(0)
  elif c[0]=="-":ce[p]-=1;c.pop(0)
  elif c[0]==".":print(end=chr(ce[p]%256));c.pop(0)
  elif c[0]==",":print(end=ce[p]);c.pop(0)
  elif c[0]=="*":p+=1;t=ce[p];p-=1;ce[p]=t*ce[p];p+=1;ce[p]=0;p-=1;c.pop(0)
  elif c[0]=="/":p+=1;t=ce[p];p-=1;ce[p]=ce[p]//t;p+=1;ce[p]=0;p-=1;c.pop(0)
  elif c[0]=="s":p+=1;t=ce[p];p-=1;ce[p]=t+ce[p];p+=1;ce[p]=0;p-=1;c.pop(0)
  elif c[0]=="d":p+=1;t=ce[p];p-=1;ce[p]=t-ce[p];p+=1;ce[p]=0;p-=1;c.pop(0)
  elif c[0]=="?":print(ce);c.pop(0);print(f"Currently pointing at {p}")