esolang

V3i

Three variables, and no way to close a block.

BowlingPizzaBall, 2022 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: Hello, World!

The idea

BowlingPizzaBall made V3i in 2022. The name stands for Variable 3 Input. There are only three variables, x, y and z, and every statement ends in a semicolon.

Read the story

A loop or an if has no end marker. loop 99; repeats the rest of the program 99 times, and an if runs up to its else. So the shape of a program is fixed by where its last block starts. The specification shows the language is Turing complete anyway. It puts the whole program in one iloop and turns each instruction of Infinite GotoStart with three registers into a few statements.

The machine

StatementDoes
def x x+1;Set x, y or z
print x " bottles";Print the values one after another, then end the line
if x = 1; ... else; ...Run the statements up to else, or the ones after it
loop 99;Run the rest 99 times
iloop;Run the rest forever
end;Stop
wait 500;Wait that many milliseconds; here it does not pause
# note #A comment

A header with a statement right after it, as in iloop print "1"; or else if y = "i";, takes only that statement. Values are numbers, texts in quotes, the variables and input, which reads a line. They join with * / % first, then + -, then = > <, which give 1 or 0. sqrt n takes a square root. Text that reads as a number counts as that number, so an input of 0 equals 0.

Example

The second is the truth machine.
Expected: 0
Expected: 3 left 2 left 1 left

The second is the truth machine. On 1 the else block prints 1 forever. The 99 bottles of beer works the same way. Its loop 99; holds an if x = 1; for the last verse, and the else holds every other verse, so the verse for 2 ends with 1 bottles of beer on the wall.

Further

Ideas it shows

Also in Turing tarpits

Write your own in Run Convert a program from V3i

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run v3i -e 'print input;' --input 'cat'
shib manual v3i

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/v3i.js

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

Source esolangs.org (CC0) · Edit on esolangs.org