esolang

StackPoint

A tape of numbers, and a stack of places on it. The top of the stack is where you are.

ChuckEsoteric08 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hi

The idea

ChuckEsoteric08 made StackPoint after Bub and the CINS language. It has a tape of whole numbers, like brainfuck, but no tape head. The head is the number on top of a stack. > and < move it by changing that number, and " and * push a second head to come back to later.

Read the story

Jumps go to labels. A label is a name of lowercase letters and digits, declared with name:. name^ jumps there when the current cell is 0 and name@ when it is not.

The machine

CommandDoes
> <Add 1 to or take 1 from the top of the stack
~ #Swap the top two; drop the top
" *Duplicate the top; push 0
&Reverse the stack
+ -Add 1 to or take 1 from the current cell
, .Read a byte into the current cell; print it
name:Declare a label
name^ name@Jump to it when the current cell is 0, or when it is not

The stack starts as one 0. This implementation reads the end of input as 0, skips whitespace and stops on any other character.

Example

A cat program.

A cat program. It stops on a 0 byte, and also at the end of the input.

Expected: ba

The truth machine puts 48 and 49, the characters 0 and 1, in cells 0 and 1, and the input minus 48 in cell 2. On 0 it moves the head back to cell 0 and prints it once.

Expected: 0

Patterns it teaches

Further

Cell-based

Stack-based

Write your own in Run Convert a program from StackPoint

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: stackpoint.

Command line

shib run stackpoint -e 'repeat:
,
halt^
.
repeat@
halt:' --input 'Hi'
shib manual stackpoint

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/stackpoint.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org