VoidLang

From Esolang
Jump to navigation Jump to search
VoidLang
Paradigm(s) imperative
Designed by Iovoid
Appeared in 2016
Memory system stack
Dimensions one-dimensional
Computational class Pushdown automaton
Reference implementation Node.JS interpreter (GitHub)
File extension(s) no standard ending

A stack-based language. It supports eval, user input, loops, and basic math. It was designed by iovoid.

Operators

  • " starts and end pushing to stack
  • ! prints the first element of stack, deleting it
  • * multiply the two first elements of stack, deleting the originals
  • / will divide the first element of stack with the second, deleting the originals
  • + will add two first elements of stack, deleting the originals
  • - will remove the first element of stack with the second, deleting the originals
  • [ starts a loop
  • ] ends a loop
  • ~ breaks from a loop
  • ? break if the first element of stack is 0
  • # break if the length of stack is 1 or 0
  • . pop first element of the stack
  • % adds a random item to the stack, from 1 to 255
  • $ push the length of the stack
  • _ replace first item of stack with it converted to a string, if impossible return the original
  • & eval the concatenation of all elements in the stack, replaces stack with output
  • , take a line of input from stdin
  • ; does nothing
  • ^ push the program code to the stack
  • | actually print the output (! is still needed)
  • = end the program

Computational class

VoidLang is an extended pushdown automaton with multiply and divide, but has no way of performing divisibility checking without destroying the counter since there is no instruction which takes an element of the stack and produces at least two elements based on it. Therefore, it is in the class of push-down automata.

Examples =

Hello, World!
"Hello, World!"[#!]

What's done here? First, " opens the pushing of items to stack (H,e,l,l,o,...), later " closes it. Inside a loop, every item of the stack is printed until its empty.

Other Hello World!
"89"*_!"ello World!/"[!#]

Here, the / is purposefully eaten by [!#] that will ignore the last character

REPL (Read-Eval-Print Loop)
,&[#!]$^&

Here, input is asked with , and then & evals it. Later a [!#] prints everything, like in Hello, World!.

Cat program
,[#!]$^&

^& will repeat the program by eval-ing itself

Cheating quine
^[#!]

Implementations