Callable
Every value is a string and every statement is a function call.
PythonshellDebugwindow, 2020 · Turing complete: yes · ●○○ easy · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
PythonshellDebugwindow made Callable in 2020. A program is a list of calls such as PRINT("hi"), one per line, and the arguments of a call are strings or other calls. There are no numbers, no operators and no blocks. Eleven built-in functions do everything. Even an if is a call, IF-EQ(a, b, ...), which runs its later arguments only when the first two are the same string.
Read the story
The specification says Callable is Turing complete, because it can run Bitwise Cyclic Tag.
The machine
| Function | Arguments | Does |
|---|---|---|
CAT | 2 | Joins two strings |
PRINT | 1 | Prints its argument and gives it back |
INPUT | 0 | Reads a line |
SEEK | 2 | Finds the second string in the first and gives as many characters after it |
SUBTRACT | 2 | Takes the second string off the front of the first, if it is there |
VAR-GET VAR-SET | 1, 2 | Read and set a variable |
IF-EQ IF-NEQ | 3 or more | Run the rest once if the first two are equal, or unequal |
WHILE-EQ WHILE-NEQ | 3 or more | Run the rest while the first two are equal, or unequal |
A string holds any character but ", line breaks included, and has no escapes. A call to a function that does not exist, or with the wrong number of arguments, stops the program.
Example
The Hello, world! puts its line break inside the string.
The Hello, world! puts its line break inside the string.
The truth machine keeps the input line in n. On 0 the loop never starts and it prints 0; on 1 it prints 1 forever.
SEEK gives the characters that follow a match. "AYS" starts at the second character of "HAYSTACK", so it gives the three characters after it.
The cat loops while "" equals "", which is always. The end of the input reads as an empty line, so the cat prints empty lines and never stops on its own.
Further
See also
Also in Functional and concatenative
Write your own in Run Convert a program from Callable
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: callable.
Command line
shib run callable -e 'PRINT("Hello, world!
")'shib manual callableSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/callable.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org