esolang

Simp

No declarations and no definitions, only rewriting rules, with the input as the argument of main.

Hakerh400, 2026 · Turing complete: yes · ●●● hard · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: desserts

The idea

Hakerh400 made Simp in 2026. A program is rules of the form lhs === rhs. Whenever a term matches a left side anywhere, it is replaced by the right side. A single letter or a name that starts with _ is a variable and matches any term. Every other name, and a single letter with arguments, is a function. Functions exist because rules use them, and reverse(x) and reverse(a, x) are two different functions.

Read the story

The program even builds its own syntax. Directives declare operators, and the order of the lines gives their precedence. Other directives say which functions numbers, lists, characters and strings are made of. With syntax_nat natCons, 375 means natCons(natCons(3, 7), 5), and each digit is a constant with no meaning until a rule gives it one.

The machine

LineDoes
f(x, 0) === xA rule; a single letter or a name that starts with _ is a variable
infixl "+" infixr "::"An operator; each line binds tighter than the ones above
prefix "!" postfix "?"One-argument operators
syntax_nat natConsNumbers fold their digits with natCons
syntax_list nil cons[x, y] means cons(x, cons(y, nil))
syntax_char char syntax_str str'a' means char(97), "ab" means str(['a', 'b'])
-- noteA comment

The input becomes a string the way a string literal would, and the run reduces main(input). Arguments are reduced before the term around them. The result has to be a string again, and that is the output. The specification leaves open which rule wins when two match; it is the first.

Example

Reversing a string with an accumulator, the way the specification's own reverse works.

Reversing a string with an accumulator, the way the specification's own reverse works.

A declared operator is just a function with a symbol for a name.

Expected: hihi

The one big program is a brainfuck interpreter in 310 lines. It builds binary numbers from nb(a, b0) and nb(a, b1), with rules for adding, subtracting, multiplying and dividing them, and runs a brainfuck program given before a ; on the input after it. The run prints 12345...Hello, World!, and so does this one.

Further

Ideas it shows

Also in Rewriting

Write your own in Run Convert a program from Simp

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run simp program.txt --input ',[+.,]+[-->-[>>+>-----<<]<--<---]>-.>>>+.>>..+++[.>]<<<<.+++.------.<<-.>>>>+.;01234---'

The program is long; save it as program.txt first.

shib manual simp

Source

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

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

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