esolang

Exp

Every line works out one sum, and every number is a row of carets between two bars.

PythonshellDebugwindow, 2019 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: HELLO WORLD

The idea

PythonshellDebugwindow made Exp in 2019. The name is short for expression. A program is a list of lines, and each line that is not blank works out one expression and prints it, as a character or as a whole number, or keeps it in the accumulator. There are no loops and no jumps, so every program halts after its last line. The specification files it under finite state automata and unusable for programming.

Read the story

Numbers are written in unary. 5 is |^^^^^| and 0 is ||. To print one letter of Hello World the program multiplies two of them and adds or takes away a third.

The machine

CodeDoes
{...}Print the value as a character
{{...}}Print the value as a whole number
<...>An expression, worked out from left to right
|^^^|A number, the count of carets
+ - x /Add, take away, multiply, divide
~The accumulator, the only variable
IThe next character of input
@~After the braces, keep the value in the accumulator and print nothing

There is no order of operations and there are no parentheses, so <|^^| + |^^^| x |^^^^|> is 20, not 14. The specification leaves a few things open. In this implementation the accumulator starts at 0, I gives 0 after the last character, / rounds toward 0 and a number prints with nothing after it.

Example

The Hello World.

The Hello World. Its first line is 9 times 8, which is 72, an H.

The cat copies one character. It reads the first and stops.

Expected: c

The specification adds two characters of input and keeps the sum in the accumulator. On !! the sum is 33 + 33. A line that ends in @~ stores its value and prints nothing. The specification never says so outright, but it calls its two versions of this program equivalent and says they output one integer, and only this reading makes both true.

Expected: 66
Expected: 66
Expected: 20

Further

Also in Turing tarpits

Write your own in Run Convert a program from Exp

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run exp -e '{<I>}' --input 'a'
shib manual exp

Source

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

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

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