CalScript

From Esolang
Jump to: navigation, search

CalScript is an esoteric programming language created by User:Vriskanon. It has a stack and tape memory model and has an alphabet of only the tokens "HAA", "HEE" and "HOO".

Commands

Commands are built up from a 'command tree' that groups commands based on their roots. Each part of a command denotes the class of the command (for example, all commands beginning with 'HAA' are based around stack manipulation).

Token Class
HAA Stack Manipulation
HEE Tape Manipulation
HOO Stack and Tape Interaction

HAA - Stack Manipulation

Token Class
HAA Stack Entity Manipulation
HEE Stack Arithmetic
HOO Stack and the Abstract

HAA HAA - Stack Entity Manipulation

Token Class
HAA Move the top item of the stack to the bottom
HEE Move the bottom item of the stack to the top
HOO Pop (destroy) the top item of the stack

HAA HEE - Stack Arithmetic

Token Class
HAA Addition and Subtraction
HEE Multiplication and Division
HAA HEE HAA - Addition and Subtraction
Token Class
HAA Pop the top two items of the stack, add them and push the result onto the stack
HEE Pop the top item of the stack then pop the top item of the stack. Take the second item popped from the stack from the first item popped from the stack and push that value onto the stack
HAA HEE HEE - Multiplication and Division
Token Class
HAA Pop the top two items of the stack, multiply them and push the result onto the stack
HEE Pop the top item of the stack then pop the top item of the stack. Divide the first item popped from the stack by the second item popped from the stack and push that value onto the stack

HAA HOO - Stack and the Abstract

Token Class
HAA If statements
HEE Printing and inputs
HAA HOO HAA - If Statements
Token Class
HAA If the top item of the stack is 0, push 1 onto the stack. Otherwise, push 0
HEE If the top item of the stack is 0, push 0 onto the stack. Otherwise, push 1.
HAA HOO HEE - Printing and Inputs
Token Class
HAA Pop the top item of the stack and print its ASCII value
HEE Take a single character input and push its ASCII value onto the stack

HEE - Tape Manipulation

Token Class
HAA Tape pointer manipulation
HEE Entity arithmetic
HOO Tape and the abstract

HEE HAA - Tape Pointer Manipulation

Token Class
HAA Move the pointer one to the right
HEE Move the pointer one to the left

HEE HEE - Entity Arithmetic

Token Class
HAA Add one to the entity under the pointer
HEE Subtract one from the entity under the pointer

HEE HOO - Tape and the Abstract

Token Class
HAA If statements
HEE Printing and inputs
HEE HOO HAA - If statements
Token Class
HAA If the entity under the pointer is 0, it becomes 1. Otherwise, it becomes 0
HEE If the entity under the pointer is 0, it becomes 0. Otherwise, it becomes 1
HEE HOO HEE - Printing and Inputs
Token Class
HAA Prints the ASCII value of the entity under the pointer
HEE Takes a single character input and the entity under the pointer becomes that character's ASCII value

HOO - Stack and Tape Interaction

Token Class
HAA Moving from stack to tape
HEE Moving from tape to stack
HOO Stack and tape arithmetic

HOO HAA - Moving From Stack to Tape

Token Class
HAA Pop the top item of the stack. The entity under the pointer becomes that value
HEE Copy the top value of the stack. The entity under the pointer becomes that value

HOO HEE - Moving From Tape to Stack

Token Class
HAA Push the value of the entity under the pointer onto the stack. The value of the entity under the stack becomes 0
HEE Push the value of the entity under the pointer onto the stack

HOO HOO - Stack and Tape Arithmetic

Token Class
HAA Pop the top item of the stack and add its value to the value of the entity under the stack, push that value onto the stack and the entity under the pointer becomes that value
HEE Pop the top item of the stack and subtract it from the value of the entity under the pointer, push that value onto the stack and the entity under the pointer becomes that value
HOO Pop the top item of the stack and subtract from it the value of the entity under the pointer, push that value onto the stack and the entity under the pointer becomes that value

List of Commands

As the tables may be somewhat confusing, this is a comprehensive list of all commands:

Command Class
HAA HAA HAA Move the top item of the stack to the bottom
HAA HAA HEE Move the bottom item of the stack to the top
HAA HAA HOO Pop (destroy) the top item of the stack
HAA HEE HAA HAA Pop the top two items of the stack, add them and push the result onto the stack
HAA HEE HAA HEE Pop the top item of the stack then pop the top item of the stack. Take the second item popped from the stack from the first item popped from the stack and push that value onto the stack
HAA HEE HEE HAA Pop the top two items of the stack, multiply them and push the result onto the stack
HAA HEE HEE HEE Pop the top item of the stack then pop the top item of the stack. Divide the first item popped from the stack by the second item popped from the stack and push that value onto the stack
HAA HOO HAA HAA If the top item of the stack is 0, push 1 onto the stack. Otherwise, push 0
HAA HOO HAA HEE If the top item of the stack is 0, push 0 onto the stack. Otherwise, push 1
HAA HOO HEE HAA Pop the top item of the stack and print its ASCII value
HAA HOO HEE HEE Take a single character input and push its value onto the stack
HEE HAA HAA Move the pointer one to the right
HEE HAA HEE Move the pointer one to the left
HEE HEE HAA Add one to the entity under the pointer
HEE HEE HEE Subtract one from the entity under the pointer
HEE HOO HAA HAA If the entity under the pointer is 0, it becomes 1. Otherwise, it becomes 0
HEE HOO HAA HEE If the entity under the pointer is 0, it becomes 0. Otherwise, it becomes 1
HEE HOO HEE HAA Prints the ASCII value of the entity under the pointer
HEE HOO HEE HEE Takes a single character input and the entity under the pointer becomes that character's ASCII value
HOO HAA HAA Pop the top item of the stack. The entity under the pointer becomes that value
HOO HAA HEE Copy the top value of the stack. The entity under the pointer becomes that value
HOO HEE HAA Push the value of the entity under the pointer onto the stack. The value of the entity under the stack becomes 0
HOO HEE HEE Push the value of the entity under the pointer onto the stack
HOO HOO HAA Pop the top item of the stack and add its value to the value of the entity under the stack, push that value onto the stack and the entity under the pointer becomes that value
HOO HOO HEE Pop the top item of the stack and subtract it from the value of the entity under the pointer, push that value onto the stack and the entity under the pointer becomes that value
HOO HOO HOO Pop the top item of the stack and subtract from it the value of the entity under the pointer, push that value onto the stack and the entity under the pointer becomes that value