You already know how English works, even if you've never thought about it. Add 'ed' to walk and you get walked. Add it to jump and you get jumped. But add it to go and you don't get goed — you get went. Every language runs on rules like these, plus a long list of exceptions. Most of us learn them by ear and never write them down.
About 2,400 years ago, in the region of Gandhara in what is now north-west Pakistan, a scholar named Pāṇini wrote them all down — for Sanskrit. Every rule, every exception, every way sounds change when they meet, in 3,959 lines so compressed that students could learn the whole thing by heart. Feed his rules a root like bhū, 'to be', apply them in order, and out comes bhavati, 'he is'. Feed them a different root, and a different correct word comes out. It's less like a grammar book and more like a machine.
To make it short enough to memorise, Pāṇini invented tricks that programmers would reinvent two thousand years later. He used placeholders that mean 'present tense' before deciding which ending to use. He attached silent tag letters to word-pieces — letters that are never pronounced but switch other rules on, then disappear. He named whole groups of sounds with two-letter codes. And he wrote a rule for deciding which rule wins when two of them clash.
That last rule is still being argued over. For two thousand years, scholars read it as 'the rule that comes later in the book wins'. In 2022, a Cambridge student named Rishi Rajpopat argued it actually means 'the rule that applies further right in the word wins' — and showed it fixes many cases the old reading got wrong. Headlines said a 2,500-year-old puzzle had been solved. In 2026, one of the field's most senior scholars, Paul Kiparsky, replied that the new reading breaks in many other cases. Two experts, in the age of AI, are still debugging a program written for the human memory.
The lesson Pāṇini leaves isn't really about Sanskrit. It's about the difference between knowing a lot of answers and knowing the rules that produce them. Anyone can memorise words. Pāṇini wrote the machine that makes them.
Core Philosophy
Pāṇini treated a language as a system that could be generated, not just described. Instead of listing correct words, he wrote the rules that produce them: start from a root, attach abstract placeholders, substitute real endings, let hidden tags switch other rules on, and join the sounds — and every correct Sanskrit word falls out, with no incorrect ones. To make 3,959 rules short enough to memorise, he invented machinery that looks startlingly modern: variables, tags, abbreviations for whole sets, context carried silently from one rule to the next, and meta-rules for deciding which rule wins when two apply at once. He wasn't writing a textbook. He was writing a program, for human minds to run.
Don't list the answers; write the rules that produce them. A good rule system says more in four thousand lines than any list could in a million.
How They Thought
Thinking Process
- 01
Separate the abstract from the concrete
He first attaches a placeholder that means only 'present tense', and decides the actual ending later. Splitting what something means from how it's spelled let one set of rules cover thousands of verb forms — the same move a programmer makes with a variable.
- 02
Tag things with silent metadata
Many of his word-pieces carry extra letters that are never pronounced. The tag ś on śap, for example, sorts it into a category that triggers vowel-strengthening elsewhere in the word. The tags do work, then vanish — exactly how hidden labels work in software.
- 03
Name groups, not members
He arranged all the sounds of Sanskrit into 14 short lines, the Shiva Sutras, so that any run of sounds can be named with two letters: 'ec' means e, o, ai and au; 'ac' means every vowel. One rule can then cover a whole class of sounds at once.
- 04
Never say anything twice
Words in one rule are silently carried into the rules that follow until the context changes — a device called anuvṛtti. Rules can be just two or three words long because they inherit the rest. The cost is that you can't read a rule on its own; you have to know where it sits.
- 05
Decide in advance how conflicts are settled
When two rules could both apply, a meta-rule decides which one wins. Building the tie-breaker into the system, rather than leaving it to the reader's judgement, is what makes the grammar behave like an algorithm.
Every technique serves one goal: the shortest possible description that still generates every correct word. That obsession with compression is exactly what makes the grammar look like code.
Transferable Frameworks
Mental Models
Placeholders Before Values
Decide what kind of thing goes in a slot before deciding which thing. Pāṇini's 'present tense' marker stands in for many possible endings until the context picks one — and the same logic underlies every form, template and database schema.
Tag Your Data
A small hidden label can switch behaviour far away. Instead of writing special-case rules, mark the pieces themselves and let general rules read the marks.
Name the Set
If you keep listing the same members, give the group a name. Two-letter labels for whole classes of sounds let one rule do the work of dozens.
Inherit, Don't Repeat
Say something once and let it carry forward until it stops applying. It makes a system short and consistent, at the price of needing context to read any one part.
Write the Tie-Breaker First
Any system with many rules will hit cases where two apply. Decide up front how conflicts resolve, or the system's behaviour depends on whoever is reading it.
Programmers rediscovered every one of these ideas in the 20th century. Pāṇini needed them because his 'computer' was a human memory with no paper.
From Description to Generation
Grammarians Before Him Explained Words. Pāṇini Wrote the Rules That Produce Every Correct One.
Analysis, Word by Word
Earlier Indian scholars — Pāṇini names several, including Śākaṭāyana and Āpiśali — studied pronunciation, word origins and how words break into parts, mainly to preserve the exact sound of the Vedic hymns.
A Complete Generative System
The Aṣṭādhyāyī ('eight chapters') sets out 3,959 rules that, applied in order from roots and affixes, generate the forms of Sanskrit — a system later commentators spent two thousand years explaining, extending and arguing over.
The language didn't change. What changed was the question: not 'is this word correct?' but 'what procedure produces all the correct words and none of the wrong ones?' That is the question every programming language grammar answers today.
The Output
Big Ideas
Which Rule Wins? A 2,400-Year-Old Argument
Rule 1.4.2 says that when two rules conflict, the para one wins — and para can mean 'later' or 'further right'. For about two thousand years the standard reading was 'the rule that comes later in the book wins', which produced wrong words often enough that commentators added patches. In a 2022 Cambridge PhD thesis, Rishi Rajpopat argued for the other meaning: the rule that applies to the right-hand part of the word wins. He showed it produces correct forms in many cases where the old reading fails, and headlines announced a 'puzzle solved after 2,500 years'. The argument isn't over. In 2026 the Stanford linguist Paul Kiparsky replied that Rajpopat's principle 'yields the wrong results in a large class of cases' and defended an older account. What's striking is that two modern scholars are still debugging the same 2,400-year-old program.
Code Before Computers
In 1959, John Backus devised a notation for defining the grammar of a programming language; with Peter Naur's refinements it became Backus–Naur form, still used to specify languages today. In 1967 Peter Ingerman wrote to the journal Communications of the ACM proposing it be renamed Pāṇini–Backus form, because Pāṇini's rules work on the same principle: rewrite a symbol into other symbols, step by step, until only real words remain. The renaming never caught on, but the comparison did — Pāṇini is now routinely cited as a precursor of formal language theory.
The 'NASA Said Sanskrit Is Best for Computers' Myth
A claim circulates that NASA declared Sanskrit the ideal language for computers. It traces to a 1985 paper in AI Magazine by Rick Briggs, a researcher at a NASA centre, arguing that the way Sanskrit grammarians analysed sentences had lessons for knowledge representation in AI. It made no claim that computers should run on Sanskrit, and there was no NASA programme to make them. Pāṇini's real link to computing is his method — the rule system — not the language it describes.
One of the Greatest Monuments of Human Intelligence
That was the verdict of the American linguist Leonard Bloomfield in his 1933 book Language, which shaped modern linguistics. European scholars who encountered Pāṇini in the 19th century found a complete, systematic analysis of a language's sounds and word-structure that Western grammar had nothing to match — and it fed directly into the modern science of linguistics.
The Life, Briefly
Timeline
- c. 4th century BCE
Pāṇini composes the Aṣṭādhyāyī: 3,959 rules in eight chapters, with the 14 Shiva Sutras as its sound inventory. (expand)
His dates are uncertain. Estimates run from the 6th to the 4th century BCE; evidence from coins mentioned in the text leads several scholars to place him in the mid-4th century BCE. Tradition says he came from Śalātura, in ancient Gandhara (in modern north-west Pakistan).
- c. 2nd century BCE
Patañjali writes the Mahābhāṣya, the 'Great Commentary', defending and refining Pāṇini's rules.
- 7th century CE
The Kāśikā commentary explains every rule in order with examples, becoming a standard teaching text.
- 17th century
Bhaṭṭoji Dīkṣita's Siddhāntakaumudī rearranges the rules by topic, the form in which most students learn Pāṇini to this day.
- 1933
Leonard Bloomfield calls Pāṇini's grammar 'one of the greatest monuments of human intelligence'.
- 1959
John Backus devises the notation that becomes Backus–Naur form, used to define programming languages.
- 1967
Peter Ingerman proposes, in a letter to Communications of the ACM, renaming it Pāṇini–Backus form.
- 1985
Rick Briggs's paper on Sanskrit and AI appears — later misquoted as 'NASA says Sanskrit is best for computers'.
- 2022
Rishi Rajpopat's Cambridge PhD thesis argues for a new reading of rule 1.4.2, the tie-breaker rule.
- 2025–2026
Rajpopat publishes Pāṇini's Perfect Rule (Harvard University Press); Paul Kiparsky publishes a direct rebuttal.
A text composed to be memorised and recited is still being debugged — and cited by computer scientists — 2,400 years later.
Go Deeper
Books & Resources
Aṣṭādhyāyī of Pāṇini — Sumitra M. Katre (translator)
A complete English translation with the Sanskrit rules in roman script — the best way to see how short and how strange the rules really are.
Pāṇini: His Work and Its Traditions — George Cardona
The standard scholarly introduction to how the grammar works, by one of its leading modern experts.
Pāṇini's Perfect Rule — Rishi Rajpopat
The 2025 book version of the 2022 thesis — readable, and the best way to understand the tie-breaker debate from the inside. Read it alongside Kiparsky's reply.
Scholarship Notes
- Pāṇini's dates and life are almost entirely unknown. Estimates range from the 6th to the 4th century BCE; this page follows the mid-4th-century dating several scholars derive from coin terminology in the text. His birthplace, Śalātura in Gandhara, comes from later tradition.
- Tradition says Pāṇini received the 14 Shiva Sutras from the god Shiva. Scholars treat them as part of his system, possibly building on earlier work; either way, they function as the sound inventory his abbreviations depend on.
- The bhavati derivation in the diagram is simplified for clarity. In the traditional step-by-step derivation, tag letters are identified and dropped as soon as each piece is introduced; the diagram keeps them visible until the end so you can see what they do.
- Rajpopat's reading of rule 1.4.2 is a serious scholarly proposal, not a settled result. Paul Kiparsky (2026) argues it fails in many cases, and the debate is ongoing. The page presents both.
- Ingerman's 1967 letter proposed the name 'Pāṇini–Backus form'; the standard name remains Backus–Naur form. Backus devised his notation independently, without reference to Pāṇini.
We know almost nothing about Pāṇini as a person — not even the century he lived in. What survives is a few thousand short lines that turn a root like bhū into bhavati, step by step, with placeholders, hidden tags and a rule for settling disputes between rules.
That's enough. Two millennia of commentators, a 20th-century linguist who called it a monument of human intelligence, a computer scientist who wanted to put his name on programming notation, and two modern scholars still arguing over one word in rule 1.4.2. Few people have written anything that is still being run — and debugged — 2,400 years later.