Full Stack

From Esolang
Jump to navigation Jump to search

Full Stack is an esolang created by User:Challenger5 and inspired by ///. Its Turing completeness is not known.

Before we define Full Stack, however, we must first define a language called Front End. Front End is an explicitly not Turing-complete stack-based language similar to brainfuck. For storage, it uses a stack of bytes as well as 26 variables, one for each English letter, which hold bytes.

Its commands are as follows:

  • + increments the top byte on the stack.
  • - decrements the top byte on the stack.
  • : duplicates the top byte on the stack.
  • ; deletes the top byte on the stack.
  • / swaps the top two bytes on the stack.
  • x (or any lower case letter) pushes the value of the corresponding variable.
  • X (or any upper case letter) pops a value of the stack and stores it to the corresponding variable.
  • [...] runs the code inside while the top byte is nonzero.
  • [...) runs the code inside if the top byte is nonzero.
  • (...] runs the code inside while the stack is nonempty.
  • (...) runs the code inside if the stack is nonempty.
  • {...} pushes its contents to the stack such that the last character ends up at the top. ... can contain braces as long as they match. There is no way to directly push unmatched braces.

+ and - wrap if necessary. +, -, :, and ; can be suffixed with a number to denote repetition. +, -, :, ;, and X all do nothing if the stack is empty.

A given Full Stack program will generally run multiple Front End programs in the course of its execution. Between executions of Front End programs, the values of variables are preserved. They are initially all zero.

Because it only has one stack, and the stack’s values are drawn from a finite alphabet, Front End cannot be more powerful than a push-down automaton.

The following is an example Front End snippet that adds the top two stack values together:


The Language

Full Stack is a self-modifying language; its core feature is the application of Front End programs to its own source code. In particular, the program file is treated as a queue of bytes (with the first character at the start), and bytes are repeatedly dequeued and executed as follows:

  • ] will dequeue another byte and output it.
  • [ will enqueue a byte from input. It sets the variable e to 0 if EOF is reached.
  • < repeatedly dequeues bytes to form a Front End program until it finds a matching bracket, and then executes that program. As a stack, the program is supplied with the queue (where the program’s last character is at the top). The resulting stack becomes the new program code.

Any other character will simply be output.


Hello World:

<{ World!}>Hello,