esolang

Exechars

Execode squeezed to one character a command, where functions are the only control flow there is.

iddi01, 2024 · Turing complete: yes · ●●○ moderate · esolangs.org

Tested with 8 known programs · Test method

Run it

Expected: Hello, World!

The idea

iddi01 made Exechars in 2024 as a golfing version of their language Execode. Every command is one character followed by a number, and anything that is not a command is part of a number, written in hexadecimal. +48 adds 1 to variable 0x48; r48+0 adds 1 to variable 0 that many times, so it sets it to 72.

Read the story

There are no jumps and no loops. A conditional skips the next instruction, and a function is the only thing that can repeat code, by calling itself. So a while loop is a function that tests and calls itself at the end. Writing v after a number reads a variable instead, which turns /2v into a call through a table of functions, the way the Deadfish interpreter picks a command.

The machine

CommandDoes
+x -xAdd 1 to variable x; take 1
(x ... ) /xDefine function x; call it
^x>y *x>y &xPush variable x onto stack y; pop stack x into variable y; reverse a stack
?x=y ?x!y ?x<ySkip the next instruction unless x = y; unless x differs; unless x < y
rxRun the next instruction x times
ix ox nxRead a number; print a character; print a number
sx lxPrint a stack as text; as numbers
tEnd

Popping an empty stack, or reading past the end of the input, gives 65535.

Example

The calculator sets variables a and b to the codes of + and =, then adds both inputs into variable 2 by…
Expected: 16+35=51

The calculator sets variables a and b to the codes of + and =, then adds both inputs into variable 2 by repeating +2 as many times as each input says.

The truth machine is a function that prints the input and calls itself unless the input equals a variable that is 0.

Expected: 0

Further

Ideas it shows

Deque-based

Golfing languages

Write your own in Run Convert a program from Exechars

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run exechars -e 'i0+1-1(0n0?0!1/0)/0t' --input '0'
shib manual exechars

Source

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

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

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