Description #
Thue is an esoteric, non-deterministic programming language based entirely on semi-Thue string rewriting systems. It treats computation as a series of rule-based string replacements, with no variables, loops, or flow control—just grammar rewriting.
History #
Thue was created by John Colagioia in 2000. It’s named after mathematician Axel Thue, whose early 20th-century work on formal languages laid the foundation for string rewriting systems. The language is powerful yet minimal, designed to challenge traditional programming paradigms.
Hello World Code #
a::=~Hello, World!
::=
a
This program rewrites
a
intoHello, World!
, then terminates.
How to Run #
Option 1: Online
Option 2: Local
Save program in a .thue
file
Use an interpreter such as Thue.py
Run:
python thue.py hello.thue
Key Concepts #
- Rule-based rewriting
- No functions, loops, or variables
- Uses pattern matching with
::=
- Non-deterministic if multiple rules match
- Minimal yet Turing complete
- Strings are both code and data
- Suitable for symbolic manipulation
- Can simulate any other esolang
- Logic flows through rewriting, not execution
- Great for theoretical exploration of computation
Try It Online #
Fun Facts #
- The shortest Turing-complete language by syntax
- Can simulate complex logic using just string rewriting
- One of the few languages where grammar = logic