Vitsy

Vitsy is an esoteric programming language designed by the PPCG user VTCAKAVSMoACE. It's control structure is largely linear and stores data in a stack of stacks of arbitrarily large decimals, or, more simply, a two-dimensional stack of arbitrarily large decimals. Its most common interpreters are written in Java and may be found in this GitHub repository. The Java interpreters began development in mid-October 2015 and will continue to be developed for probably all of time. More interpreters (specifically in JavaScript) based on the language (but not identical in behavior) are coming to existence thanks to PPCG users Cᴏɴᴏʀ O'Bʀɪᴇɴ, LegionMammal978, Maltysen, and RikerW.

Overview
Vitsy programs are are aware of any of the following things:


 * The main program (this is the program that you run) and the code thereof.
 * The data held in STDIN, the input stack, and the program stack.
 * The final variable, temporary variables, and objects.
 * The decimal stacks.
 * They may also be aware of other program files. These programs are loaded dynamically, allowing for programs to be changed mid-execution, if need be.

Syntax
All Vitsy programs are composed of UTF-8 text files (extension optional, typically .vt) containing commands in the Vitsy language. A Vitsy program is organized into four main components: methods,  blocks ,  commands , and  use and ext declarations.

Methods
Methods in Vitsy are separated by newlines and indexed in array format for access. When a Vitsy program is run, the first line (or the main method) is executed. Other methods will not be run unless specified by the method command with that index of the methods. Methods retain the current state of the program stack when called, as well as knowing the current values for the final variable and the temporary variable. Methods in other programs may be called through the class method command, which will call the specified index of the methods in the specified index of the use declaration s. Method calling may be recursive.

Blocks
Blocks are sections of code that are surrounded by  (the begin block command) and   (the end block command) commands which designate this section of code to act as though it was a single command. All blocks will continue until closed by the end block command, meaning that if the block is not terminated before the end of the method, they will return to the beginning of the current method and continue until finding their close block. Block behavior is largely dependent on what the command previous to the block is.

Conditional Blocks
Conditional blocks are blocks preceded by the if or if not commands. If the condition for the if statement is met, the block will be executed, otherwise, it will not. Conditional blocks may not be broken out of as for loops are broken from; calling the end command inside of a conditional block will cause the previous block layer to be broken out of (or, if there are no higher levels of block, the current method will terminate).

Repeat Blocks
Repeat blocks are preceded by the repeat command and are executed as though it were a single instruction, repeating the contents of the loop as many times as would be repeated for a single command. Repeat blocks may be broken out of with the end command.

Loop Blocks
If none of the previous types of blocks are found, the block is treated as a loop block, which will loop infinitely unless:


 * broken out of with the end command
 * the integer value of the top item of the stack is zero at the end of the block

Commands
Commands are executed one at a time (unthreaded) and may affect the current state of STDIN, STDOUT, the stack, local files (disabled in safe mode), and the system (via shell) (disabled in safe mode). A list of commands is provided below.

use and ext Declarations
use and ext declarations exist solely for the purposes of calling method s from other programs from a Vitsy program. These declarations always appear at the end of a file, and an example can be found below.

0K00k ;e program2 ;u program3

In this program, I first push 0 to the current decimal stack, then I call, which executes a method in the declared ext file. The ext file is declared by  and, in this situation, references program2. Therefore, in the first two commands, we have executed the main method of program2.

Similarly, we declare use files with. In commands 3 through 5, we push 2 zeroes, then call, which executes a method in the specified declaration of use files. With, I call the 0th index of use declarations (program3's) 0th index of method s. Therefore, we have executed the main Vitsy method of program3.

Data Structures
Data is stored in various locations, some of which are read-only, some of which are neither readable nor writable until active, and some of which are readable and writeable immediately. Most data structures are stacks, but there are a few data structures aside.

Stacks
Vitsy uses multiple stacks, some of which are multi-layered and contain different values. Details for each stack type are below.

Program Stack
Vitsy is aware of all data contained in the program stack. The program stack is toroidal and consists of multiple decimal stack s. There is only one program stack per instance of Vitsy, and it may not be destroyed, but it may be modified through commands found in the Data section of the commands list. The program stack is originally instantiated with an empty decimal stack on it.

Decimal Stack
Decimal Stacks are stacks of arbitrarily large decimal values. Vitsy interacts mostly with this form of stack, and all mathematical operations are executed with values found on this stack. These stacks are toroidal and there may be many decimal stacks per program stack. Decimal stacks may be destroyed, created, and modified within the program stack through commands found in the Data section of the commands list. Each decimal stack is instantiated empty unless it is a clone of another stack.

Input Stack
String input to any Vitsy program via command line arguments which cannot be parsed as a double are placed onto the input stack. The input stack is top-access only and may only be popped from. Commands which interact with the input stack may be found under the Data section of the commands list.

Method Stack
The method stack is a trace to the currently accessed method via all the previous method s (Java style). The method stack is wholly inaccessible for information access, and is used solely for the purposes of tracing back to the place where each method was called. There is only one method stack per Vitsy instance which cannot be destroyed or modified in any fashion. The method stack is instantiated with the initial value of the main method of the main program file.

Class Stack
The class stack is a trace to the currently access program file and is closely related to the method stack, although they are wholly separate. There is only one class stack per Vitsy instance which cannot be destroyed or modified in any fashion. Current class information may be found through commands found in the Separate Program Management section of the commands list. The method stack is instantiated with the initial value of the main program file.

Variables
There are three different variable types in Vitsy - a temporary variable, a final variable, and object s. These variables are passed over method s and programs and have different behaviors as defined below.

Final Variable
The final variable may be called by the final variable command under the Data section of the commands list. When the final variable is first called, it captures the top value of the current decimal stack and retains it permanently. Any following calls to it will push its value to the current decimal stack. The final variable's value may not be dumped at any point and said final variable is passed through method calls and separate program calls.

Temporary Variable
The temporary variable may be called by the temporary variable command under the Data section of the commands list. When the temporary variable is called, it will follow one of the two following behaviors:


 * If the temporary variable does not currently have a value assigned to it, it will capture the top value of the current decimal stack and save it for later use.
 * If the temporary variable does currently have a value assigned to it, it will dump the value to the current decimal stack and clear its value.

The temporary variable's value may be dumped when the temporary variable command is called and said temporary variable is passed through method calls and separate program calls.

Objects
Objects are decimal stack s that have been captured and assigned to a specific character in the instructions. An object must be declared with the object command, which declares the following character as an object character (if it does not already have a meaning through commands) and promptly captures the current stack and pushes it to the object. When the declared object character is called again, it will follow one of the two following behaviors:


 * If the object does not currently have a stack assigned to it, it will capture the current decimal stack save it for later use.
 * If the object does currently have a stack assigned to it, it will dump the stack to the program stack, move to it, and clear its own value.

An example, as I realize this is difficult to follow:

1234oj jN j

First, we push 1, 2, 3, and 4 to the current decimal stack. Then, we assign the character  (which does not have a command meaning) as an object, grabbing the current decimal stack and assigning the object called  's value to said decimal stack. (There are now no stacks in the program stack .) I now call  again, pushing the decimal stack found in   to the program stack. I then pop the top value and output it as a number, pushing 4 to STDOUT. I now only have 1, 2, and 3 on the stack, which I then capture again by calling.

The objects's stack may be dumped when its declared character is called and the declared object is passed through method calls and separate program calls.

STDIN
Although not a data structure necessarily owned by the Vitsy instance, STDIN acts similarly to the input stack (but not exactly) in that each line is a separate item and all items of each line are pushed to the stack, evaluating as a decimal when possible. Calling for STDIN while executing through a command line causes the program to halt until a newline is read from the command line.

Input/Output
Input and output is handled in very specific ways in Vitsy. All manners in which input is accepted or output is pushed may be found below.

Command Line Arguments
Command line arguments are accepted as a form of input for Vitsy. If all command line arguments are parseable as decimals, their values are pushed onto the initial decimal stack. Otherwise, all of the command line arguments are joined with a space and pushed onto the input stack.

STDIN
Input through standard input must be explicitly requested by the Vitsy program. When being called via the STDIN command (as found in the Data section of the commands list), a single line is pulled from STDIN, attempted to be parsed as a decimal, and then pushed to the current decimal stack. If using Vitsy through the command line, Vitsy will halt when STDIN is empty and called for new data.

STDOUT
STDOUT is the only form of output used by a given Vitsy instance for normal output types. See the Data section of the commands list for how data is output to STDOUT when calling various commands.

STDERR
STDERR is only output to whenever an error is thrown, showing information about the error and what caused it. Vitsy cannot output to STDERR without throwing an error.

Hello, World!
"!dlroW ,olleH"Z

Since quotes push items to the stack in the order in which it encounters them, the string must be pushed in reverse to allow the top-access-only outputting  command to output everything in the right order.

Standard Quine
'rd3*Z

Quotes wrap around a line, meaning that, with this code, we can capture all elements of the code, then reverse the stack (for order) and push the character value for  and output everything. This is a true quine.

Trivia

 * Vitsy comes from a mispronunciation of the first three characters in VTCAKAVSMoACE.
 * Vitsy is also referred to as "Purse Dog", Flasp, and VTC's Child.
 * Vitsy is also occasionally used throughout VTCAKAVSMoACE's school by Computer Science teachers for quick calculations due to its stack-based nature and simple-to-use polish notation.
 * This wiki page for Vitsy is larger in byte count than the entire compiled Vitsy jar.

External Sources
GitHub repository for Vitsy (Java)

GitHub page for Vitsy (JavaScript)

Try It Online (online execution)