V is an esoteric programming language made by Francisco Mota. It is called V after the sequence of instructions \/.
What is it?
A V program is a series of instructions to a machine (called the operator) that operates on a sum-tree. A sum-tree is a binary tree of infinite height (both up and down). It is composed, obligatorily, of three parts: the root node which has a value, a left subtree that is also a sum-tree, and a right subtree that is also a sum-tree. The value of the root node is the sum of the value of the root nodes of its subtrees (that is, if the left-subtree's root node has the value x, and the right-subtree's root node has the value y, then our root node has the value x+y).
There are 7 instructions:
||The operator moves to the right subtree.|
||If the current tree is a left subtree, the operator ascends to its parent. Otherwise, it mirrors the sum-tree, and then ascends to the parent. Mirroring means that every left subtree swapped places with its corresponding right subtree (the values stay the same, they just switch places).|
||Decreases the left subtree's value by 1, and increases the right subtree's value by 1, preserving the root node value. To decrease a sub-tree's value by 1 is to decrease its right subtree's value by 1. Sort of similarly, to increase a sub-tree's value by 1 is to increase its left subtree's value by 1.|
|| If the root node value is zero, jumps forward to the matching |
|| If the root node value is not zero, jumps back to the matching |
||Outputs the value of the root node as an ascii character.|
||Inputs a character, stores it as the root node value. The difference between the root node's current value and the new value is added to the left subtree, and so on propagating the left subtrees. If the EOF is reached, the root node value is set to 0.|
An input file can consist of any characters, but only instructions are considered (like Brainfuck).
This sounds really complicated and convoluted. But this is an esoteric programming language, so get used to it.
> \ < /\/ + > - \/>\/ [ \[/\/ ] \]/\/ . \./\/ , \,/\/
Several optimizations could be made in this translation. For example, converting two instructions at a time:
-- \/>>\/ .- \./>\/ ., \.,/\/ [. \[./\/
are a few simple optimizations.