Skip to content
Panini Fitted the Grammar of Sanskrit Into About 4,000 Rules That Build Words Step by Step, and Linguists and Computer Scientists Study the System as a Machine
Ancient & Medieval India

Panini Fitted the Grammar of Sanskrit Into About 4,000 Rules That Build Words Step by Step, and Linguists and Computer Scientists Study the System as a Machine

Illustration by tuput

English

Panini's Ashtadhyayi, composed between roughly the fifth and fourth centuries BCE, holds about 4,000 rules that turn a base and a suffix into a correct Sanskrit word. A 1967 computing journal letter, a 1993 parsing paper from IIT Kanpur and a Cambridge doctorate announced in December 2022 all start from it.

· · 10 min read

The Ashtadhyayi is a grammar of Sanskrit made of about 4,000 rules in eight books, and it is built to run like a machine. The University of Cambridge describes the design this way: feed in the base and the suffix of a word, and a step-by-step process turns them into a grammatically correct word or sentence. Its author, Panini, worked in the north-west of the subcontinent in the centuries before the common era.

Stanford linguist Paul Kiparsky wrote in 1994 that modern linguistics acknowledges the text as “the most complete generative grammar of any language yet written”, a sentence quoted by the Düsseldorf linguist Wiebke Petersen in 2004. The American linguist Leonard Bloomfield, in 1929, called the descriptive grammar of Sanskrit that Panini brought to its perfection “one of the greatest monuments of human intelligence”, also as cited by Petersen.

What is known about Panini

Very little is certain about the man. The Encyclopedia of World Biography places his birth in Shalatula, also spelled Shalatura, a small town near Attock, in what is now Pakistan. Dates differ by source. Cambridge’s account says the Ashtadhyayi is thought to have been written around 500 BC. Rajpopat’s thesis dates it to around 350 BC, citing the Sanskritist George Cardona’s 1976 survey of research, and adds that there are many disagreements. The Encyclopedia of World Biography gives about 450 to 350 BCE.

Scholars also disagree on whether Panini used writing to compose the text. The thesis notes that Vincenzo Vergiani, the Cambridge professor who supervised it, has argued strongly that he did. Either way, the Ashtadhyayi was passed from teacher to pupil by recitation, as the Vedas were.

Two early commentaries shaped how it was read: Katyayana’s Varttikas, written by the first commentator on the text according to Rajpopat’s thesis, and Patanjali’s Mahabhashya, which the Encyclopedia of World Biography lists as the other major early work. Mathematics in Sanskrit verse has a documented early example in Aryabhata’s Aryabhatiya of 499 CE.

Four parts and one machine

The rules of the Ashtadhyayi do not work alone. Kiparsky lists four components that together form a complete grammar and lexicon: the Ashtadhyayi itself with about 4,000 rules; the Shiva Sutras, an inventory of the sounds of Sanskrit; the Dhatupatha, a list of about 2,000 verbal roots; and the Ganapatha, 261 lists of words that follow special rules. The Ashtadhyayi refers to the other three using conventions that it spells out itself.

Rajpopat’s thesis sets out the layout. The first two books mostly define terms and give metarules, which are rules about how to read and combine other rules. Books three to five teach how to add endings to verb roots and noun stems. Books six to eight cover the sound changes that follow.

The rules are terse. A rule often borrows words from the rules before it, so a reader has to carry the earlier text along to understand the later one. Kiparsky writes that almost all the technical features of the system are motivated by the demand for simplicity, which the tradition calls laghava.

Cambridge gives a worked example. To form mantraiḥ, “by the mantras”, the derivation starts with mantra plus the ending bhis. Two rules can apply at that moment, one to the left part and one to the right part, and the grammar has to choose which fires first.

Fourteen lines that name every group of sounds

The Shiva Sutras show the compression at its plainest. Petersen describes them as 14 sutras that list 42 sounds, each line ending in a marker letter that is not itself a sound. A short code made of one sound and one marker names every sound from that sound up to the marker. Her paper gives iC as an example: it names i, u, ṛ, ḷ, e, o, ai and au. The Ashtadhyayi refers to such classes of sounds in hundreds of rules. India’s other best-known system of compact notation, the place-value numerals, is told in India gave the world zero.

Petersen’s 2004 paper in the Journal of Logic, Language and Information proves, in set-theoretic terms, that Panini’s ordering of the sounds is the best possible one for this method. She also shows that he had to adjust the natural classes of sounds slightly to fit them into a list, and that the adjustment, which involves the sound h, was the best available. This is Petersen’s result and rests on her formal definition of “best”; her paper is the place to check it.

How a special rule beats a general one

Kiparsky explains one of the system’s main devices as a consequence of the same economy. If a special rule is allowed to block a general rule, the general rule can be written in plain terms without listing its exceptions. The tradition names the pair utsarga, the general rule, and apavada, the exception.

The same Kiparsky paper makes a point about influence that is easy to miss. Generative linguists, he writes, have marvelled at Panini’s conventions for ordering rules, which seem to anticipate ideas in modern theory, “if only because” many of those ideas were first borrowed from Panini. Bloomfield, he adds, admired the grammar for a different reason: it rests on general principles such as simplicity and describes one language at one time.

The 1967 letter and the name that did not stick

In March 1967 the journal Communications of the ACM printed a letter from P. Z. Ingerman, who signed as manager of language systems standards and research, headed “Panini-Backus Form Suggested”. Donald Knuth had argued in 1964 that the notation used to define the programming language ALGOL 60 should be renamed, since Backus Normal Form is not a normal form in any sense. Ingerman wrote that John Backus had discovered the notation independently, but that Panini “invented a notation which is equivalent in its power to that of Backus”. He proposed crediting Panini by name.

The name Backus-Naur Form stayed in use. Sanskritists have also questioned the comparison itself. Dominik Wujastyk, writing to the INDOLOGY list in 1993, said “Panini’s notational scheme is not similar to BNF in any meaningful way”, and explained that BNF describes a grammar while the Ashtadhyayi operates as one. In 2020 he returned to it, writing that Backus-Naur notation is often cited as a rediscovery of Panini’s methods “not entirely without justification”, but that Ingerman’s claim rests on a simplified view of the grammar that ignores rule ordering, blocking and scoping.

Where computing has used the grammar

The practical use of Panini’s ideas in computing is older than the 2022 headlines. In June 1993 Akshar Bharati and Rajeev Sangal of IIT Kanpur presented a paper at the 31st Annual Meeting of the Association for Computational Linguistics in Columbus, Ohio. It described a “Paninian framework” for parsing languages with free word order, built on the karaka relations between verbs and nouns that Panini’s grammar uses, and said the framework had been applied successfully to Indian languages.

Peter Scharf of The Sanskrit Library describes on his curriculum vitae a formalisation of the Ashtadhyayi in an XML language, completed in July 2017, that can be translated into executable code. He is building an implementation that would trace complete Panini-style derivations for a Sanskrit lexicon. Current Indian work on language technology, including the government’s Bhashini translation platform, is covered in India is building AI in its own languages.

The 2022 Cambridge result, stated precisely

On 15 December 2022 the University of Cambridge published a news story about Rishi Rajpopat, who was born in 1995 in a suburb of Mumbai, learned Panini’s grammar informally from a retired professor while studying economics, took a master’s at Oxford, and began his Cambridge doctorate in 2017 on a full scholarship funded by the Cambridge Trust and the Rajiv Gandhi Foundation. The thesis is dated July 2021, the degree was awarded in January 2022, and the text went online on the day of the announcement.

The subject is rule 1.4.2, which the thesis calls Panini’s only metarule on rule conflict. A conflict arises when two rules can both apply at the same step of a derivation. The tradition reads 1.4.2, vipratishedhe param karyam, as saying that between two rules of equal strength the one later in the grammar’s order wins.

Rajpopat’s thesis rejects that reading and proposes two principles. If the two rules apply to the same part of the word, the more specific rule wins. If they apply to two different parts, 1.4.2 means that the rule for the right-hand part wins. For mantraiḥ, that gives the rule for the ending bhis. For guruṇā, “by the guru”, built from guru plus ā, it gives the rule for ā. Cambridge reports that with this reading the grammar produced grammatically correct words “with almost no exceptions”, and says rule conflicts affect millions of Sanskrit words.

Cambridge also made a claim about computers. Rajpopat said natural language processing researchers “gave up on rule-based approaches over 50 years ago”, and that teaching computers to apply Panini’s rules to a speaker’s intention would be a major milestone. The release says leading Sanskrit experts called the discovery revolutionary without naming them. The named endorsement is Vergiani’s, who called it “an extraordinarily elegant solution to a problem which has perplexed scholars for centuries”.

Harvard University Press published Rajpopat’s book, Panini’s Perfect Rule, on 16 December 2025. Its pages carry praise from Amartya Sen and from Francis Clooney of Harvard, and the publisher says the book makes most earlier work on the problem obsolete.

What other specialists replied

Jan Houben wrote to the INDOLOGY list on 18 December 2022, three days after the announcement. He called the thesis “a very well reflected and researched work” that deserves close analysis by specialists. He said the thesis shows it is possible to apply 1.4.2 across the whole grammar, but that it does not convincingly explain why the rule sits directly after rule 1.4.1, and he cited Cardona’s 1976 survey, which lists several scholars who limit 1.4.2 to the section that 1.4.1 heads.

Peter Scharf published a review on 23 December 2022. He welcomed the attention Rajpopat had drawn to Paninian grammar, and praised the observation that Panini generally replaces the ending before changing the base. He then wrote that the procedure “does not select the correct operation in some instances” and began with the derivation of the form bhavya.

In 2026 Kiparsky replied to the book version in Cracow Indological Studies. He writes that much of Rajpopat’s framework is familiar and widely accepted, and calls the new ideas “novel and intriguing”. His abstract argues that Rajpopat’s version of generalised blocking is ill-defined, that the new principle gives wrong results in a large class of cases, and that the approach of S. D. Joshi and his collaborators accounts for both the cases Rajpopat gets right and those he does not. He adds that the right-hand principle works most of the time, calls that remarkable, and says he has no answer to why it holds.

The accounts differ on what was open before 2022. Cambridge’s release says scholars misread the rule for 2,500 years, while Houben and Kiparsky, citing work from Faddegon in 1936 onward, say specialists had already limited its reach to one section of the grammar. Kiparsky also writes that he knows of two serious reviews of the dissertation, by Scharf and by Bodas, both unpublished at the time he wrote.

Share
Copied!

Sources & further reading

  1. University of Cambridge: Solving grammar's greatest puzzle (15 December 2022)
  2. Rishi Rajpopat, In Panini We Trust: Discovering the Algorithm for Rule Conflict Resolution in the Astadhyayi (PhD thesis, University of Cambridge, 2021; published online 15 December 2022)
  3. Harvard University Press: Panini's Perfect Rule by Rishi Rajpopat (2025)
  4. Paul Kiparsky, Reparsing Panini, Cracow Indological Studies 28:1 (2026), pp. 13 to 57
  5. Peter M. Scharf, Review of Rajpopat's In Panini We Trust (The Sanskrit Library, 23 December 2022)
  6. Jan E. M. Houben, message to the INDOLOGY list on Rajpopat's thesis (18 December 2022)
  7. Paul Kiparsky, On the Architecture of Panini's Grammar (Stanford University, 2002)
  8. Wiebke Petersen, A Mathematical Analysis of Panini's Sivasutras, Journal of Logic, Language and Information 13 (2004)
  9. P. Z. Ingerman, Panini-Backus Form Suggested, Communications of the ACM 10:3 (March 1967), reproduced on the INDOLOGY list
  10. Dominik Wujastyk, message to the INDOLOGY list on Backus-Naur notation and Panini (13 April 2020)
  11. Encyclopedia of World Biography via Encyclopedia.com: Panini
  12. Akshar Bharati and Rajeev Sangal, Parsing Free Word Order Languages in the Paninian Framework, ACL 1993
  13. Peter M. Scharf, Analytic curriculum vitae (The Sanskrit Library)

Researched and written with the help of AI tools and edited for accuracy. Provided for general information and discussion only, not professional advice. See our editorial standards and disclaimer. Spotted an error? Tell us.

#panini#ashtadhyayi#sanskrit#grammar#linguistics#biography#ancient india#computing

Enjoyed this? Get the next one.

One good read at a time, straight to your inbox. No spam, unsubscribe anytime.

More in Ancient & Medieval India
Kanishka's Kushan Empire Reached From Bukhara to Patna, His Gold Coins Carried the Buddha, and the Peshawar Stupa Identified as His Measured 286 Feet Across
A Bactrian inscription says Kanishka inaugurated year one, and a fourth-century Sanskrit astronomy text lets scholars turn that year into 127 CE. Around it sit gold coins, a bronze casket of relics and a council that a Chinese pilgrim placed in Kashmir.
In 499 CE, a 23-Year-Old Said the Earth Spins
He was 23. He said the stars only look like they move: it's the Earth that turns. He was right, a thousand years early, and his own tradition spent centuries explaining him away.
Seleucus Gave Chandragupta the Lands Along the Indus for 500 Elephants. Four Greek and Roman Writers Recorded the Deal, and It Took Until 1793 to Say Who the King Was
A Greek ambassador described the wooden wall around Pataliputra, and in 1876 workmen digging a tank in Patna struck rows of old timber. The textbook of statecraft credited to Chandragupta's minister has no such check, and Olivelle and McClish both date the text we have to centuries after his reign.
← all articles