esolang

v^v

Two useful characters. Only the length of each run of v counts.

Username1234, 2022 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: 5

The idea

Username1234 made v^v in 2022, and its article writes the name as v to the power v. A program is runs of v split by ^, and the length of each run is a command from 1 to 7. Everything after )) is a comment.

Read the story

There is no way to write a number. A program pushes 1 and counts it up, four v for each step, so a letter costs hundreds of characters and the Hello World is 5,704 long. Command 6 is the one shortcut. It raises the top of the stack to its own power, mod 128.

The machine

RunDoes
vPush 1
vvPop
vvvPrint the top as a character
vvvvAdd 1 to the top
vvvvvTake 1 from the top
vvvvvvRaise the top to its own power, mod 128
vvvvvvvEnd the program

The specification gives an interpreter in Common Lisp and one in Python, and they agree in the specification's programs. This implementation follows the Python one, which skips any other character and does nothing for a run of 0 or more than 7.

Example

1 counted up to 5.

1 counted up to 5. Five to the power 5 is 3,125, which is 53 mod 128, the character 5.

Nine to the power 9 is 73 mod 128, an I. A comment follows the )).

Expected: I

The programs that print CCF and Hello, World! are included too. Both come from its own generator, which writes one push, a count up, a print and a pop for every character.

Patterns it teaches

Further

Also in Turing tarpits

Write your own in Run Convert a program from v^v

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run vv program.txt

The program is long; save it as program.txt first.

shib manual vv

Source

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

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

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