Ly
Many stacks in a row, a backup cell, and loops that only look at the top.
LyricLy, 2017 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 7 known programs · Hello World on Try It Online: identical · Test method
Run it
The idea
LyricLy made Ly in 2017, inspired by ><>. The code runs left to right like an ordinary program, but the data lives on an endless strip of stacks. < and > move between them, which is enough to copy brainfuck and so makes the language Turing complete. A single backup cell holds one value, or one whole stack, for later.
Read the story
Two habits come from code golf. When an instruction pops an empty stack, Ly reads a number from the input instead. And when a program runs off its end, the current stack is printed as numbers.
The machine
| Command | Does |
|---|---|
0-9 (123) "text" 'x | Push a digit, a number, characters, one character |
+ - * / % ^ | Pop x, then y, push y op x; / always gives a float |
: p f r a y | Duplicate, pop, swap, reverse, sort, push the length |
= G L ! N | Equal, greater, less than the top; not; negate |
` , c S J R | Add 1, take 1, count digits, split digits, join, range | |
< > s l | Move along the strip; copy to and from the backup cell |
o u i n | Print a character or a number; read a line as characters or a number |
[ … ] $ ; | Loop while the top is not 0; break out; stop |
& | The next of n o u + : p s works on the whole stack |
Functions, written F{...}, are not implemented.
Example
The second is the prime test from esolangs.org.
The second is the prime test from esolangs.org. It keeps the number in the backup cell and tries every divisor below it. The third is a truth machine. The last never prints; it runs off its end, and the 35 left on the stack is the implicit output.
Further
Ideas it shows
See also
Stack-based
Write your own in Run Convert a program from Ly
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: ly.
Command line
shib run ly -e '94/u'shib manual lySource
- Module
langs/tio/ports.js- Interpreter
langs/tio/ly.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org