Markov normal algorithms

← Back to the course page

Write the initial word in the input window. Type the algorithm into the algorithm window, one rule per line. Press Step to apply one rule, Run to apply rules automatically (press again to stop), or Reset to start over from the input word. Edits to the input or the algorithm only take effect once you press Reset, which reloads the word and the rules.


Syntax. Every rule is a line of the form lhs -> rhs. Empty left- and right-hand sides are allowed: -> rhs, lhs ->, and -> are all valid syntax. A rule whose arrow is followed by a dot, e.g. lhs ->. rhs, is a terminal rule.

Semantics. Each step looks for the first rule from the top whose left-hand side occurs in the word, and applies it to the leftmost occurrence. The word is rewritten and the search starts again from the first rule. An empty lhs or rhs stands for ε, so -> rhs inserts rhs at the front of the word. A rule lhs -> erases the matched string. A rule -> just does nothing. The computation stops (and the current word is the result) when a terminal rule is applied, or when no rule applies at all. Algorithms that never terminate are interrupted after 1000 steps.