aboba
Numbered variables, a stack and brainfuck's loop, made in one day.
R3D, 2021 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 3 known programs · Test method
Run it
The idea
R3D made aboba in one day in 2021, after brainfuck. There is no tape. There are numbered variables, %N opens one of them, and every other command works on the one that is open. Numbers are written out, so +72 adds 72 in a single step. A stack sits beside the variables for arithmetic, and [N ...] runs a block only when the open variable is N. That is how the calculator picks its operator.
The machine
| Command | Does |
|---|---|
%N | Open variable N |
+N -N | Add N to it or take N from it |
( ) | Print it as a character or as a number |
ic in | Read a character or a number into it |
{ ... } | Loop while it is not 0 |
[N ... ] | Run the inside only when it is N |
?< ?> | When it is 0, jump back or forward to the nearest wall, | |
sp sg | Push it; pop into it |
sd sw | Duplicate the top; swap the top two |
s+ s- s* s/ | Pop two and push the top plus, minus, times or divided by the other |
~ | End the program |
" | A comment to the end of the line |
Every variable starts at 0, and every other character does nothing. Numbers have no size limit, and in reads a whole line and takes the number on it.
Example
Hello World walks one variable from letter to letter.
Hello World walks one variable from letter to letter.
The calculator reads two numbers and an operator, each on its own line. sw puts the first number on top, so - takes the second from the first. An operator it does not know prints Invalid!.
The Fibonacci program keeps the last two numbers in variables 1 and 2, adds them on the stack and stops with [17711 ~]. Variable 4 holds 10, the line feed.
Patterns it teaches
- Stack machines: a stack beside the variables does the arithmetic.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from aboba
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: aboba.
Command line
shib run aboba -e '%1 +72 ( +29 ( +7 ( ( +3 ( -79 ( +55 ( +24 ( +3 ( -6 ( -8 ( -67 ('shib manual abobaSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/aboba.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org