A Turing-complete esoteric language that compiles 17th-century English legal prose into pure SKI combinator calculus.
STATUTORY demonstrates that English syntax admits a recursively embeddable construction whose structure is isomorphic to a fixed-point combinator. By exploiting the Demonstrative/Relative homophony of "that" and the Auxiliary/Transitive homophony of "had," we construct a grammatical carrier that, when equipped with explicit operational semantics, enables unbounded computation.
This repository contains the formal spec, the theoretical paper, and the official Tree-sitter GLR parser.
Example
WHEREAS we define the Fibonacci sequence;
that that had had that which, given the recourse and the number,
yields the number being less than two selecting between the number as the former
and the recourse applied to the predecessor of the number added to
the recourse applied to the predecessor of the predecessor of the number as the latter,
hereinafter referred to as FIBONACCI;
FIBONACCI applied to six
Output: RESULT: 8
Prerequisites
You must have Python development headers installed to compile the Tree-sitter C-bindings.
| Platform | Command |
|---|---|
| Ubuntu/Debian | sudo apt install python3-dev |
| macOS | brew install python |
| Arch Linux | sudo pacman -S python |
Installation
We recommend using a virtual environment to manage the C-extensions.
# 1. Initialize the environment python3 -m venv .venv source .venv/bin/activate # 2. Install dependencies & build bindings pip install "tree-sitter>=0.22.0" pip install .
Usage
Execute a .stat file using the provided interpreter:
python run.py examples/factorial.stat
Architecture
Standard LALR(1) parsers fail on English because of structural homophony (e.g., "that" as demonstrative vs. relative pronoun). Tree-sitter handles this via a GLR runtime that forks at the "that that" collision, successfully generating the AST.
Supported Mechanics
| Feature | Description |
|---|---|
| Fixed-Point Recursion | Implements the Z-Combinator via that that had had |
| Church Promotion | Automatic coercion of numerals into higher-order functions |
| Lexical Scoping | Proper closure capture for multi-argument curried functions |
| Currying | Multi-parameter abstractions desugar to nested lambdas |
Language Reference
Abstraction (λ)
that which, given the number, yields the successor of the number
Application
Recursion (Z-Combinator)
that that had had that which, given the recourse and the n, yields ...
Conditionals
the number being naught selecting between unity as the former
and the number multiplied by the recourse applied to the predecessor of the number as the latter
Definitions
that which, given the x, yields the x multiplied by the x,
hereinafter referred to as SQUARE;
Comments
WHEREAS this text is ignored by the parser;
Grouping & Precedence
Unary operators (the successor of, the predecessor of) are right-greedy—they consume the entire expression to their right. When their result must be passed as an argument, explicit grouping is required.
STATUTORY provides two grouping mechanisms:
Modern Notation (Parentheses)
the recourse applied to ( the predecessor of the m ) applied to unity
Clear and concise. Recommended for practical use.
Pure English (Aforesaid Clause)
the recourse applied to that which is the predecessor of the m aforesaid applied to unity
Grammatically valid 17th-century legal English. The phrase "that which is X aforesaid" functions as a nominal clause referring back to the expression X.
This form preserves the theoretical claim that STATUTORY is a subset of natural language. However, nested groupings become unwieldy:
that which is the recourse applied to the m applied to
that which is the predecessor of the n aforesaid aforesaid
Which Should I Use?
| Use Case | Recommended Form |
|---|---|
| Practical programming | Parentheses |
| Theoretical demonstration | Aforesaid clauses |
Examples
The examples/ directory contains working programs demonstrating Turing-completeness:
Tier 1: Basic Recursion
| File | Description | Output |
|---|---|---|
factorial.stat |
n! via recursive multiplication | 5! = 120 |
fib.stat |
Fibonacci sequence | fib(6) = 8 |
division.stat |
Integer division by repeated subtraction | 6 ÷ 2 = 3 |
Tier 2: Essential Algorithms
| File | Description | Output |
|---|---|---|
ackermann.stat |
Ackermann function (non-primitive recursion) | A(2,3) = 9 |
modulo.stat |
Remainder via repeated subtraction | 7 mod 3 = 1 |
gcd.stat |
Euclidean algorithm | gcd(8,6) = 2 |
Tier 3: Theoretical Showpieces
| File | Description | Output |
|---|---|---|
primality.stat |
Trial division primality test | isPrime(7) = 1 |
collatz.stat |
Collatz sequence step counter | steps(6→1) = 8 |
isqrt.stat |
Integer square root via Newton's method | √10 = 3 |
Bonus: Pure English Variant
| File | Description |
|---|---|
aforesaid_ackermann.stat |
Ackermann using only aforesaid clauses (no parentheses) |
Compilation to WASM (Optional)
For browser-based graph reduction:
Theory
The theoretical foundation is described in the paper included in paper/.
The Key Insight
English syntax admits a recursively embeddable construction whose structure is isomorphic to a fixed-point combinator. We call this a fixed-point carrier:
Φ(X) = that(D) that(R) had(Aux) had(V) X
Where:
- D = Demonstrative pronoun ("that thing")
- R = Relative pronoun ("which")
- Aux = Auxiliary verb (tense marker)
- V = Main verb ("possessed")
This operator maps noun phrases to noun phrases (NP → NP) and can be applied to itself, yielding unbounded structural embedding without explicit naming.
What This Proves
A fixed-point combinator is defined by behavior under evaluation, not shape alone. English provides the carrier—the syntactic structure—but not the reduction rules. STATUTORY supplies the operational semantics that transform the carrier into a working combinator.
The precise claim is:
English admits grammatically well-formed sentences that, when restricted to a controlled subset and equipped with explicit operational semantics, constitute a Turing-complete programming language.
The Ω-Carrier
The Φ-carrier is not unique. Any construction where a pronoun serves as both Head and Relativizer, and a verb serves as both Auxiliary and Transitive Main Verb in identical form, produces an equivalent carrier:
Ω(X) = that(D) that(R) will(Aux) will(V) X
Here "will" functions as future tense marker and as the verb "to bequeath." This yields pure AABB lexical symmetry without morphological inflection.
Cognitive Incomputability
While Φⁿ(that) is grammatical for all n, human parsing fails at n ≈ 2 due to working memory constraints. The construction is lexically self-similar at every level, preventing semantic chunking. This mirrors the evaluation of (Y Y) in an eager language: well-formed but incomputable under finite resources.
The perceived limit on natural language recursion is a cognitive stack overflow, not a grammatical bound.
License
MIT