CURSI is an esoteric programming language based on recursion and composition. It comes with a very minimal set of basic functions that are composed to create more meaningful functions.
A CURSI script operates on a global stack that can contain signed integers and
functions. The stack is initially populated with the space-separated user input.
Each line of the script defines a function. The first character of the line is the function's name, the rest is its code string (spaces are completely ignored). Each character in the code string is a reference to another function. When the function is invoked, these references are in turn called sequentially. Note that functions inside
() are not called, but instead pushed onto the stack.
CURSI comes with the following built-in functions:
- Pushes a 0 onto the stack.
- Increments the number at the top of the stack.
- Decrements the number at the top of the stack.
- Duplicates the value at the top of the stack.
- Deletes the value at the top of the stack.
- Gets and deletes the number n at the top of the stack. Then looks down the stack n elements and moves the found element to the top of the stack.
- Deletes the number at the top of the stack and outputs it.
- Deletes the number at the top of the stack. Then converts it to a Unicode character and outputs it.
- Gets and deletes the number at the top of the stack. If it is not 0, the current function returns.
- Deletes and executes the function at the top of the stack.
Any CURSI script must have a main function with the name
When the script is executed, that main function is invoked first.
Note that typing in the "interactive" prompt overrides the main function with the code string
from the prompt.