YASBL

From Esolang
Jump to navigation Jump to search

YASBL stands for "Yet Another Stack Based Language" .

YASBL is a language with a 1D format, with 1-character opcodes, much like Brainf*** . It was inspired by the demo creation tool IBNIZ and its programming language. YASBL works on an infinite stack of infinite stacks, called the "stack-stack", unlike IBNIZ, which only uses one stack.

Syntax

(command) = i - / 0 d x p o D N X P O I, whitespace or (macrochar) {Case sensitive}
(commands) = 1 or more of (command) concatenated in a string together. Whitespace is ignored.
(macrochar) = Any ASCII character that isn't + - / d x p N D X P : or whitespace
(macro) = newline then (macrochar): (commands)
code = (commands) then 0 or more (macro)

Command reference

Operation   Char   Description
Increment    i      Increments the top value of the stack on the top of the "stack-stack".
Subtract     -      Pops 2 values off the top stack of the "stack-stack", subtracts one from the other, and pushes the result.
Divide       /      Same as - but does a division instead of a subtraction.
Push 0       0      Pushes 0 onto the stack on the top of the "stack-stack".
Duplicate    d      Duplicates the top value of the stack on the top of the "stack-stack".
eXchange     x      Swaps the top 2 values of the stack on the top of the "stack-stack".
Pop          p      Pops the top value of the stack on the top of the "stack-stack".
Output       o      Pops the top value of the stack on top of the "stack-stack" and outputs it as an ASCII character.
New Stack    N      Pushes an empty stack onto the "stack-stack".
Stack Dup    D      Duplicates the stack on the top of the "stack-stack".
Stack Swap   X      Swaps the top 2 stacks on the "stack-stack".
Stack Pop    P      Pops off the top stack of the "stack-stack".
Output       O      Pops the top value of the stack on top of the "stack-stack" and outputs it as a number.
Input        I      Inputs a character from the user and pushes its character code onto the top stack of the "stack-stack".
Run          R      Pops off and runs the top value of the top stack as an ASCII value for a command.
Branch       B      If the top value of the top stack is 0 then use the second-top value as an address to skip to.

Macros

Macros start with a character used to represent it, and then they contain the code the macro character must represent. Macros can contain macro characters that were defined before the current macro. A macro is of the format:

(macro character): (commands)

Macro Examples

Addition

+: 0x--

Multiplication

*: 0ix//

Decrement

v: 0i-

Code Examples

Hello World

0iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiio
0iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiio
LLE0iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiio
0iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiio
E0iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiioL
0iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiio
0iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiio
E: 0iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiio
L: 0iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiio

Cat (puts input directly back to output)

io00B