esolang

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

Expected: Hello, world!

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

FunctionArgumentsDoes
CAT2Joins two strings
PRINT1Prints its argument and gives it back
INPUT0Reads a line
SEEK2Finds the second string in the first and gives as many characters after it
SUBTRACT2Takes the second string off the front of the first, if it is there
VAR-GET VAR-SET1, 2Read and set a variable
IF-EQ IF-NEQ3 or moreRun the rest once if the first two are equal, or unequal
WHILE-EQ WHILE-NEQ3 or moreRun 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.

Expected: 0

SEEK gives the characters that follow a match. "AYS" starts at the second character of "HAYSTACK", so it gives the three characters after it.

Expected: TAC

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

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 callable

Source

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