esolang

Markov algorithm

Ordered rewriting rules. Each step replaces the first match of the first rule that matches, until none does.

esolangs.org

Tested with 3 examples and 3 known programs · Test method

Run it

Example

Expected output

|||||

Output


What it is

Markov algorithm: our notation, "a->b" per line, "a->.b" halts, # comments; input in, final string out

How its machine works

Its machine has rewriting of the program text.

Examples

Example

Expected output

||||||

Output


Example

Expected output

ba

Output


Quirks

  • A run stops after 3,000,000 steps.

Ideas it shows

Also in Rewriting

Write your own in Run Convert a program from Markov algorithm

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run markov -e 'a->.b
b->c' --input 'aa'
shib manual markov

Source

Module
langs/dialects/ports.js
Interpreter
langs/dialects/rewriting.js

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

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