esolang

CalScript

A stack, a tape and 26 commands, all spelled with three words. HAA, HEE, HOO.

Vriskanon, 2015 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: c

The idea

Vriskanon made CalScript in 2015. Its whole alphabet is three tokens. Each command is a path through a tree, three or four tokens deep, and each token picks a branch. The first says what the command works on (HAA the stack, HEE the tape, HOO both), the next one narrows it down, and so on to a leaf.

Read the story

The machine has a stack and a tape of integers. There is no jump and no loop, so a program runs once from top to bottom. The Hello World is 13,924 characters long. For each letter it adds 1 to a cell as many times as the letter's code, pushes the cell onto the stack, which sets the cell back to 0, and prints the top.

The machine

CommandDoes
HAA HAA HAA HAA HAA HEEMove the top of the stack to the bottom, or the bottom to the top
HAA HAA HOODrop the top
HAA HEE HAA HAA HAA HEE HEE HAAPop two, push the sum or the product
HAA HEE HAA HEE HAA HEE HEE HEEPop a, then b, push a - b or a / b
HAA HOO HAA HAA HAA HOO HAA HEEPush 1 or 0 if the top is 0, else 0 or 1
HAA HOO HEE HAA HAA HOO HEE HEEPop and print a character; read one and push it
HEE HAA HAA HEE HAA HEEMove the tape pointer right or left
HEE HEE HAA HEE HEE HEEAdd 1 to the cell or take 1 away
HEE HOO HAA HAA HEE HOO HAA HEEMake the cell 1 or 0 if it is 0, else 0 or 1
HEE HOO HEE HAA HEE HOO HEE HEEPrint the cell; read a character into it
HOO HAA HAA HOO HAA HEEPop the top into the cell, or copy it there
HOO HEE HAA HOO HEE HEEPush the cell and set it to 0, or just push it
HOO HOO HAA HOO HOO HEE HOO HOO HOOPop v, make the cell cell + v, cell - v or v - cell, and push it

Tokens are separated by spaces or line breaks. Any other word stops the program before it starts. Division rounds down, and the end of the input reads as 0.

Example

The one-time cat reads one character into the cell and prints it.

The one-time cat reads one character into the cell and prints it.

Read a character, add 1 to it, print it.

Expected: I

Subtraction takes the second number popped from the first. This pushes 2, then 8 and 8, multiplies them and adds 3. The top is 67 and the one below it 2, and 67 - 2 is 65, an A.

Expected: A

Patterns it teaches

Further

Cell-based

Stack-based

Write your own in Run Convert a program from CalScript

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run calscript -e 'HEE HOO HEE HEE
HEE HOO HEE HAA' --input 'cat'
shib manual calscript

Source

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

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

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