VAST

From Esolang
Jump to navigation Jump to search

VAST is an esoteric programming language created by User: Zero player rodent. Although it is a turning tarpit, it still has a large amount of commands compared to most other turning tarpits. The reason why it has so many commands is because the creator did not want the code to look too similar to other languages.

Description

VAST uses both cell-based and stack-based data structures. There are only two cells that the user can access, but the stack is infinite. Like every turning tarpit, VAST uses "wheels" to switch commands for the computer to execute. There are two wheels used in VAST.

These are the commands on each wheel.

Commands on wheel 1 (The number after the '#' is the number of times the wheel was turned. If the wheel was turned once if the number of times turned equals -1, it will count it as being turned 0 times.)

#0[ Set the pointer to cell 1 ] 
#1[ Do nothing ] 
#2[ Increment the cell the pointer is on by 1 ] 
#3[ Do nothing ] 
#4[ Set the pointer to a random cell ]

Commands on wheel 2 (The number after the '#' is the number of times the wheel was turned.)

#0[ Do nothing ] 
#1[ Set the pointer to cell 2 ] 
#2[ Do nothing ]
#3[ Push the value of the cell the pointer is on to the top of the stack ] 
#4[ Print the value at the top of the stack as an ASCII character ]

Commands

Command (no quotation marks) Outcome
' ' Execute the command associated with both wheels. Set wheel one's number of times turned to -1 if it has been turned over 4 times. Set wheel two's number of times turned to 0 if it has been turned over 4 times.
'~' Turn wheel 1 if wheel 1 has been turned under 2 times.
'^' Turn wheel 1 is wheel 1 has been turned over 2 times.
'=' Turn wheel 2 if wheel 1 has been turned under 2 times.
'-' Turn wheel 2 is wheel 1 has been turned over 2 times.
'/' Pop the value at the top of the stack.
'l' Pop the value at the top of the stack if the value at the top of the stack is equal to the value of the cell the pointer is on
']' Makes the value in the cell the pointer is on equal to 0.
'_' Multiplies the value of the cell the pointer is on by 2.
'v' Pushes one byte of user input to the top of the stack as an ASCII value.
';' Goes past the next ":" if the value at the top of the stack is equal to 0.
':' Goes to last ";" if the value at the top of the stack is higher than 0.
'!' Goes to last ";" if the value at the top of the stack is not equal to 1.

Explanation

To explain how the language works, here is the process of creating a program that simply prints 'a'.

The code below will cause the value of cell 1 to equal 10.

~~         

The '~~' symbols turn wheel 1 two times, meaning the command that increments the pointer can be used. Now that the wheel has been turned twice, the spaces afterward increment the pointer. The ' ' command is only used 9 times because the value of the cells are 1 by default. Now the '_' command will be used to multiply the value, and quickly set the value of the cell to 80.

~~         ___

Now that cell 1 is equal to 80, it will be incremented to equal 97, the ASCII value for 'a'.

~~         ___                 ^^^ === = 

After the cell is incremented to 97, the '^' command is used to turn the wheel enough times that it will be set back to -1 turns. The reason '^' is used instead of '~' is because '^' is used when the wheel has been turned over 2 times. This is done so the cell is not incremented with further use of ' '. After that, '=' is used to turn the second wheel 3 times, allowing ' ' to push the value of cell 1 on top of the stack. Then wheel 2 is turned again, allowing ' ' to print out the value at the top of the stack as an ASCII character.

Code examples

~~     ____       --- - - -     ____    -- - - -    -- -  - ^^^--- = 

Code that prints out "hello"

~~               _   ---^^-----^^ = ~~~              _      ^^ =--   - / / 

Simple slot machine game. Keep playing until you match 3 characters.

~~ === =^^^;v /:

Cat program.

~~ === =^^^;v:- === == ==== ; /!

Program that reverses user input.

~~                                              ---  ^^^-v|/ 

Simple if/else program. If you input '1' it will output '0'. Otherwise, it will output '1'.

External resources

Interpreter source code (Ruby)