esolang

Alumin

Twenty-six commands, one for each lowercase letter, and numbers are written as runs of h.

Conor O'Brien · Turing complete: unknown · ●●○ moderate

Tested with 6 known programs · Hello World on Try It Online: identical except the line end · Test method

Run it

Expected: 49

The idea

Conor O'Brien made Alumin as a stack language that uses only lowercase letters. There are no digits: a run of n h pushes n, so 7 is hhhhhhh, and bigger numbers are built with t to multiply and a to add. Its Hello World is 108 letters long.

The machine

A stack of whole numbers. This implementation follows the Ruby interpreter at github.com/ConorOBrien-Foxx/Alumin, which TIO runs. When the program ends, the stack is printed, one item per line.

CodeDoes
h run, zPush its length, push 0
a tAdd, multiply
c g bSecond minus top, divided by top, modulo top
e u vEqual as 1 or 0, the larger, the smaller
d k y r lDuplicate, drop, swap, reverse, push the length
i jRead a character, read a line as a number
n oPrint a number, print a character
q … pLoop while the top is positive
f … fFold the stack with the commands between
m … mMap the commands over every item
w sMove the top n items to a new stack; bring the old one back
xA random number below the top

This implementation uses a fixed-seed generator for x so a run can be replayed, and leaves out x on 0, which gives a random fraction.

Example

The first squares 7.
Expected: 3210
Expected: 21

The first squares 7. The second counts down from 3: print the top, subtract 1, and loop while it is positive; the 0 that stops the loop is printed as the leftover stack. The third pushes 1 to 6, with spaces to keep the runs of h apart, and folds them with a.

Patterns it teaches

  • Stack machines: every command works on the top of one stack.
  • Code golf: an alphabet of 26 commands with no digits at all.

Further

Also in Golfing

Write your own in Run Convert a program from Alumin

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run alumin -e 'jjan' --input '20
22
'
shib manual alumin

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/alumin.js

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