RHOVL
One variable that every command passes through, 26 registers, and a heap for functions.
Andrew Phillips, 2021 · Turing complete: yes · ●●○ moderate · esolangs.org
Tested with 6 known programs · Test method
Run it
The idea
Andrew Phillips made RHOVL in 2021. The name stands for Register, Heap, One Variable Language. Every command works on a single variable. A number sets it, a letter loads one of the 26 registers into it and =a stores it back. +3 adds to it, <5 turns it into 1 or 0 and $ prints it. The specification says every value is a byte. Conditions, loops and a for each over a list are all brackets, so the cat is five characters long.
Read the story
Every lowercase word is code too. Each letter loads a register, and in the examples that changes nothing that gets printed, so they write their comments as plain words. One of them hides a store. {...} = factorial puts the function in f and then loads a, c, t, o, r, i, a and l.
The machine
| Code | Does |
|---|---|
3 a | Set the variable to a constant or a register |
= a | Store the variable in a register |
+ x | Change the variable by a register or a constant |
< x | Make it 1 or 0 by a comparison |
+= a | Change the register by the variable instead |
# #_ #' | Read a character, a character that is not white space, a number |
$ | Print the variable as a character |
$' $_ $, | Print it as a number, then nothing, a space, or a comma and a space |
(A:B) | Run A, then B if the variable is not 0 |
(A;B) | Run A, and while the variable is not 0 run B and A again |
(A) | Run A, then give the variable back its old value |
[xyz: A] | Run A with the variable set to each value in turn |
[abc; A] | The same, storing each result back in its register |
[xyz: A :abc] | The same, storing the results in a, b and c |
{ A } | Put a function on the heap; the variable gets its number |
@x | Run function x on the same variable |
The arithmetic is + - * / % ^ & | ~, where ^ is a power and ~ is exclusive or, and the comparisons are < > <= >= == !=. $` prints the number with a line feed. A "string" in a list stands for its character codes. Arithmetic wraps at 256.
Example
The cat reads a character and, while it is not 0, prints it.
The cat reads a character and, while it is not 0, prints it. At the end of the input # gives 0. The truth machine prints the number it read and loops while it is not 0.
The factorial keeps the product in j. (1=j) sets j to 1 and gives the variable back. (;*=j-1) multiplies j by the variable and counts it down to 0. It is called on 5.
The specification also has a list test that squares 1 to 4 and sums a list, and a function that compares 3 with 1 to 5.
Further
See also
Also in Turing tarpits
Write your own in Run Convert a program from RHOVL
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: rhovl.
Command line
shib run rhovl -e '(#;$)' --input 'Hello, cat!'shib manual rhovlSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/rhovl.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org