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
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
| Command | Does |
|---|---|
+x -x | Add 1 to variable x; take 1 |
(x ... ) /x | Define function x; call it |
^x>y *x>y &x | Push variable x onto stack y; pop stack x into variable y; reverse a stack |
?x=y ?x!y ?x<y | Skip the next instruction unless x = y; unless x differs; unless x < y |
rx | Run the next instruction x times |
ix ox nx | Read a number; print a character; print a number |
sx lx | Print a stack as text; as numbers |
t | End |
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…
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.
Further
Ideas it shows
See also
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 execharsSource
- 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