Yet Another Stack-Based Esoteric Programming Language

From Esolang
Jump to navigation Jump to search

Yet Another Stack-Based Esoteric Programming Language (or YASBEPL) is... uh, well it's what it's called.
It was created by User:Fly in 2026.

Instructions

Instruction Description
>N Pushes a numeric literal `N` onto the stack.
< Pops (removes) the top value.
+ Pops top two values, pushes their sum.
- Pops top two values (`a` first, then `b`), pushes `a-b`.
@ Pops top value and prints it as an ASCII character.
% Pops top value and prints it as a number.
# Reads a line from input; if not empty, pushes the corresponding ASCII value.
$ Reverses the whole stack.
: ... ; Executes loop body repeatedly while stack is non-empty and top value is not `0`.
? Compares top two values: if equal, continue normally; if different, skips next instruction (or skips whole next loop block if next token is `:`).
= Duplicates the top value.
! Stops the program.

Hello, World!

>72>101>108=>111>32>87>111>114>108>100>33$:@;

Truth-Machine

>48#->1$?:=%;$<>0$?%

Shorter version:

>49#?:=@;>0%

Even shorter version:

>49#?:=@;@

Counter from 1 to 10

>11>1:=%>10@>1+?-;

Stack manipulation

These are a couple of operations you can do to manipulate the stack found by the Discord user @marr_ales_fios

Rightward rotation

 $>0$:>1>0-+$>1+$;< 

Leftward rotation

 >0$:>1>0-+$>1+$;<$ 

Duplicate second-to-top element

 >0$:>1>0-+$>1+$;<$=>0$:>1>0-+$>1+$;<$ 

Duplicate bottom element

 >0$:>1>0-+$>1+$;<$=$>0$:>1>0-+$>1+$;< 

Computational class

Yet Another Stack-Based Esoteric Programming Language is Turing Complete, via BCT:

10 --> >1?:$2$0;<
11 --> >1?:$1$0;<
0 --> <

wrapping the whole program in : ... ;.
Q.E.D

Interpreter

you can try the interpreter in this GitHub repo:

https://github.com/mmmmosca/Yet-Another-Stack-Based-Esoteric-Programming-Language