LRIP
Every character is built up from 0, one shift and one increment at a time.
Lebster, 2020 · Turing complete: unknown · ●●○ moderate · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Lebster made LRIP in 2020, and its name is its first four commands. There are no number literals. To print a letter the program starts from 0 and builds the code bit by bit from the highest bit down, doubling with L and adding 1 with I. Then + pushes a fresh 0 for the next one. Only the top of the stack can be changed or tested, so the items below wait until a - brings them back up.
The machine
| Command | Does |
|---|---|
L R | Shift the top one bit left or right |
I | Add 1 to the top |
P | Print the top as a character |
+ - | Push a 0; pop |
k | Read a character and push its code |
( ) | brainfuck's loop, on the top |
The stack starts as one 0, and popping the last item leaves a 0. Small letters work as well, and line feeds are left out. The specification's Python interpreter reads with input('? '), so k prints ? first and wants a line of one character.
Example
Hello world.
Hello world. ILLLILLL builds 72, which is 1001000 in binary, so the first P prints H.
The alphabet builds 65 once, prints A, and then adds 1 and prints 25 more times.
A loop runs while the top is not 0. This program pushes the i and then the H, and (P-) prints and pops until it meets the 0 at the bottom.
Patterns it teaches
- Stack machines: a stack where only the top can be touched.
- Turing tarpit: brainfuck's loop and four ways to change one number.
Further
- esolangs.org/wiki/LRIP
- brainfuck, whose loop it borrows.
See also
Stack-based
Write your own in Run Convert a program from LRIP
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: lrip.
Command line
shib run lrip -e 'ILLLLLLIPIPIPIPIPIPIPIPIPIPIPIPIPIPIPIPIPIPIPIPIPIPIPIPIPIP'shib manual lripSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/lrip.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org