esolang

Vitsy

A stack of stacks of arbitrarily large decimals, driven one character at a time.

VTCAKAVSMoACE, 2015 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 9 known programs · Hello World on Try It Online: identical · Test method

Run it

Expected: Hello, World!

The idea

Vitsy was made in 2015 by VTCAKAVSMoACE, a user of the Programming Puzzles and Code Golf site. Its interpreter is written in Java and keeps every number as a Java BigDecimal, so 13/N prints 20 decimal places and a5/N prints a plain 2. The language borrows from ><> and reads one line of characters, each one an instruction.

Read the story

Strings are pushed one character at a time, so a Hello World is written backwards and printed with Z, which empties the stack from the top. A quote wraps round the end of the line until it meets its partner, which makes for a six character quine.

The machine

CommandDoes
0-9, a-fPush 0 to 15
"...", '...'Push each character code, wrapping round the line
+ - * / MArithmetic on the item below and the top
D X $ r lDuplicate, drop, swap, reverse, length
N O ZPrint a number, a character, the whole stack
< >Run left or right; running left wraps round
;End

Each line of a file is a method and the first one is the program. The full language also has blocks, conditions, repetition, a stack of stacks, variables and calls into other files; this implementation keeps the core above and stops on the rest.

Example

The quine pushes rd3*Z by wrapping round to its own quote, reverses it, and makes the quote character as…
Expected: 'rd3*Z
Expected: 0.33333333333333333333
Expected: 2E+1

The quine pushes rd3*Z by wrapping round to its own quote, reverses it, and makes the quote character as 13 times 3. The last line is 10 divided by 0.5, written as Java writes that BigDecimal.

Patterns it teaches

  • Quine: a quote that wraps round the line reads the whole program.
  • Stack machines: output goes through the stack, top first.

Try this

  1. Print 42 with N.
  2. Print your name with O only.
  3. Hard: print the quine's output twice.

Further

Also in Golfing

Write your own in Run Convert a program from Vitsy

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run vitsy -e '34*N'
shib manual vitsy

Source

Module
langs/tio/ports.js
Interpreter
langs/tio/vitsy.js

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

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