Luther

Luther is a tiny implementation of Thue written in LuaJIT. It features a fully nondeterministic rewriting process (any rule, anywhere in the string) as well as the ability to apply all possible rules. This means the following program:

a::=x
b::=y
c::=z
::=
abc

Will become xyz in a single turn. This loosely emulates the idea of multithreaded rewriting. Additionally, Luther features support for input (:::) and output (~).

Since the original spec for Thue is vague about spaces, Luther chooses to be whitespace significant.

Examples

A Small RPG

Source Code
_::=:::
P.::=_PM
P.::=_P.
p.::=_pM
p.::=_pH
p.::=_p.

PM::=_p.|
PM::=_P.|
PM::=_P.|

pM::=_x. (game over!)
pM::=_p.|
pM::=_p.|

pH::=_P.
::=
_P.

Triangle

Source Code
#::=
X::=~_
Y::=~*
Z::=~\n
_.::=._X
_*::=*_Y
._|::=.Z-|
*_|::=Z
..-::=.-.
**-::=*-.
*.-::=*-*
.*-::=.-*
@.-::=@_.
@*-::=@_*
::=
@_*...............................|

Streaks

Source Code
.::=█

█::=█
█::=█
█::=▊

▊::=▊
▊::=▊
▊::=▋

▋::=▋
▋::=▋
▋::=▌

▌::=▌
▌::=▌
▌::=▍

▍::=▍
▍::=▍
▍::=▎

▎::=▎
▎::=▎
▎::=▏

▏::=▏
▏::=▏
▏::=.
::=
..............................................................................

Source Code

(show raw)