Stackint

From Esolang
Jump to navigation Jump to search

Stackint is an esolang by User:PythonshellDebugwindow. Its only method of storage is, as its name suggests, a stack of integers.

Memory model

Stackint uses an arbitrary-length stack of arbitrary-size signed integers.

Syntax

The syntax of a program in Stackint is much the same as one in brainfuck; that is, it's made up of a series of characters, each one being its own command that takes no arguments and returns no value.

Commands

Command Effect
0-9 Push that number to the stack
N Push user input as a signed base-10 integer; if the integer is invalid, then 0 is pushed instead
+ Pop A and B, push A + B
- Pop A and B, push A - B
* Pop A and B, push A * B
/ Pop A and B, push A // B (floor division)
? Pop A; if A is nonzero, then pop B and jump to the 0-based Bth character in the program (B stays on the stack if A is zero)
! Like ?, but pops A and B from the bottom of the stack
& Duplicate the top of the stack
% Duplicate the bottom of the stack (push the duplicate to the bottom)

All other characters are ignored, and popping a number when the stack is empty returns 0. The language is case-insensitive.

Output

At the end of the program, the stack can optionally be output as an array would be in Python; that is, surrounded by square brackets and separated by commas and spaces. Optional for interpreters.

Examples

Output the ASCII values for Hello World as an array

98*99*54*+99*93*+99*93*+99*65*+84*99*6+99*65*+99*93*+6+99*93*+91+91+*

Cat

N

Quine

[1]

Interpreters