Markov algorithms have been shown to be Turing-complete, which means that they are suitable as a general model of computation and can represent any mathematical expression from its simple notation. Markov algorithms are named after the Soviet mathematician Andrey Markov, Jr.
Refal is a programming language based on Markov algorithms.
Here is an example of a normal algorithm scheme in the five-letter alphabet |*abc:
The Rules are a sequence of pairs of strings, usually presented in the form of pattern → replacement. Each rule may be either ordinary or terminating.
Given an input string:
1. Check the Rules in order from top to bottom to see whether any of the patterns can be found in the input string.
2. If none is found, the algorithm stops.
3. If one (or more) is found, use the first of them to replace the leftmost occurrence of matched text in the input string with its replacement.
4. If the rule just applied was a terminating one, the algorithm stops.
5. Go to step 1.
Note that after each rule application the search starts over from the first rule.