esolang

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

Expected: hello world

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

CodeDoes
3 aSet the variable to a constant or a register
= aStore the variable in a register
+ xChange the variable by a register or a constant
< xMake it 1 or 0 by a comparison
+= aChange 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
@xRun 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.
Expected: Hello, cat!

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.

Expected: 0
Expected: 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,

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.

Expected: 120

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

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 rhovl

Source

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