esolang

ASCIIORb

Characters built from ones and tens, kept on a stack, and printed only at the very end.

Threesodas, 2022 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: d

The idea

Threesodas made ASCIIORb in 2022. It works on three stacks. STAK holds numbers, STAC holds the characters to print, and STAQ holds every action the program has taken. A number can only start as 1 or 10. To make a character, a program piles ones and tens on STAK and moves them to STAC all at once, where they arrive as their sum.

Read the story

The action stack saves typing. 9 REP 0 runs the first action nine more times. There are no jumps and no tests, so every program ends.

FIN prints a stack from the top down and ends the run. A word is built backwards, its last letter first, so that its first letter ends up on top.

The machine

CommandDoes
INC s INQ sPush 1 or 10
a PUSH b a PEK bMove or copy the top of a onto b
a PUSHAL b a PEKAL bMove or copy every value; onto STAC they arrive as one sum
DROP s DROPAL sRemove the top or every value
n REP iRun action i of the action stack n more times
FIN sPrint the stack as characters, top first, and end

Each command goes on the action stack once it has run, counted from 0 at the bottom. Nothing can take an action off it.

Example

This is the specification's own picture of the stacks.

This is the specification's own picture of the stacks. Ten tens go on STAK and arrive on STAC as 100, which prints as d.

Expected: ABA

Peeking and dropping. Six tens and five ones make 65, an A. One more 1 makes a B, and dropping it gives the A back. PEKAL sends the sum and leaves the numbers where they are.

Expected: Hi

The i goes first, as 105, and the H after it, as 72, so the H is on top and prints first.

Patterns it teaches

Further

Stack-based

Write your own in Run Convert a program from ASCIIORb

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: asciiorb.

Command line

shib run asciiorb -e 'INQ STAK
9 REP 0
STAK PUSHAL STAC
FIN STAC'
shib manual asciiorb

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/asciiorb.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org