DEV Community

Cover image for 🔁 Thue — The Language Built Entirely on String Rewriting Rules
Pʀᴀɴᴀᴠ
Pʀᴀɴᴀᴠ

Posted on

🔁 Thue — The Language Built Entirely on String Rewriting Rules

What is Thue?

Thue is an esoteric programming language created by John Colagioia in 2000. It is based entirely on term rewriting systems, meaning the program consists of rules that repeatedly replace substrings of text with other substrings. Instead of traditional syntax, loops, variables, or operators, Thue programs evolve through rewriting — transforming the input string step by step until output appears.

Thue is named after mathematician Axel Thue, whose work on rewriting systems influenced early computer science, formal grammars, and theoretical models such as context-sensitive grammars. The language is intentionally minimal but extremely powerful — capable of Turing-complete computation using nothing but rewriting patterns.


Specs

Language Type: Esoteric / Formal Grammar System

Released: 2000

Creator: John Colagioia

Execution Model: String rewriting rules

Syntax Foundation: Formal language theory and grammar rewriting

Capabilities: Fully Turing-complete


CODE EXAMPLE (Hello World)

A simple Thue “Hello World” program may look like:

a::=Hello, World!
::=a
a
Enter fullscreen mode Exit fullscreen mode

Explanation:

  • a::=Hello, World! is a rewrite rule
  • a is the initial state
  • When rewritten, it becomes the final output

How It Works

  • A Thue program consists of two sections:
    1. Rewrite rules
    2. Initial string
  • Rules follow the format:

Top comments (0)