Skip to content

← Sanskrit

Pāṇini's machine

Chapter 27 · What Sanskrit carried

In this chapter 3 sections
  1. From वृद्धिरादैच् to अ अ
  2. One word, through the rules
  3. What computer scientists see

An old promise about grammar goes like this:

एकः शब्दः सम्यग्ज्ञातः शास्त्रान्वितः सुप्रयुक्तः स्वर्गे लोके कामधुग्भवति

One word, properly known, understood by the rules and used well, becomes a wish-granting cow in the world of heaven. The line is quoted in the महाभाष्य (Mahābhāṣya), the Great Commentary on पाणिनि’s grammar by पतञ्जलि (Patañjali), and पतञ्जलि lets someone poke at it. If one word does all that, the question goes, why does anybody bother to use a second word, or a third? His answer is five words long: न वै कामानां तृप्तिरस्ति. There’s no such thing as having enough of what you want.

The rules that the wish-cow word has to be known by are पाणिनि (Pāṇini)’s, in a book called the अष्टाध्यायी (Aṣṭādhyāyī), “the eight chapters”. Tradition makes him a man of गान्धार (Gandhāra), from a town near Attock on the Indus, in what is now Pakistan, and names his mother, दाक्षी, so he is also called दाक्षीपुत्र, Dākṣī’s son. When he lived is not known. The usual guess is about 2,400 years ago or earlier, but the dates scholars give are spread over three centuries and more, and every one of them is a guess. What survives is the grammar, and it is one of the strangest and cleverest books ever made: almost four thousand rules, most of them a few syllables long, built to produce the correct words of the Sanskrit he knew, and to keep out the wrong ones.

From वृद्धिरादैच् to अ अ

The first rule is three words run together:

वृद्धिरादैच्

आ, ऐ and औ are called वृद्धि (vṛddhi). That is the word Chapter 14 used for the fuller join, अ and ए making ऐ, and Chapter 18 for the second step of a root’s vowel, कृ to कार्. Here it is being defined, and the definition is built out of the machinery of Chapter 26: ऐच् is a name from the fourteen lines, ऐ and औ, and आत् is आ with a marker त् that says “only this long one”. The next rule defines the other step: अदेङ् गुणः, अ and the pair एङ्, ए and ओ, are called गुण. Then a third rule says which vowels take these steps: इको गुणवृद्धी, “गुण and वृद्धि, of इक्”, the vowels इ, उ, ऋ and ऌ. In three rules and eight words, the grammar has set up the whole system of vowel steps that runs through Sanskrit from root to word.

The rules are so short because almost nothing in them is said twice. पाणिनि gives a word once and lets it run on into the following rules until another rule displaces it, the way a speaker says “Pema likes tea, and Bishnu coffee”, leaving out the second “likes”. A heading at the top of a section can cover dozens of rules this way; the section of joins starts with a rule of one word, संहितायाम्, “in continuous speech”, and every join after it, इको यणचि among them, is understood to happen only there. Grammarians call this carrying-on अनुवृत्ति (anuvṛtti). It is what makes the rules impossible to read one by one. A rule in the middle of the book can mean little until you know which words have been carried into it from above.

The grammar is more than its rules. Beside them are the fourteen lines of sounds; a list of about two thousand verb roots, each tagged with markers that say how it behaves; and 261 lists of words that some rule treats in a special way. The rules point into the lists, the lists carry markers the rules read, and the whole is one system.

Two habits keep it from falling apart. When a general rule and a special rule both fit, the special one wins: the grammar is full of rules that state a broad pattern and then, a few rules later, carve out the exceptions. And when two rules of equal standing clash, विप्रतिषेधे परं कार्यम्: in a conflict, the later one is done. Near the end of the book a further switch is thrown. The rule पूर्वत्रासिद्धम् says that from this point on, a rule counts as not done for the rules before it. The last three quarters of the eighth chapter, mostly fine sound changes, are thereby made to apply strictly one after another, each blind to the ones that come later.

And then the book ends, on its shortest rule of all:

अ अ

Two letters, the same letter twice. Chapter 26 said why it is needed: for the whole grammar the short अ has been treated as open, the partner of आ, so the rules about long and short would work. The last rule turns it back into the closed अ that Sanskrit really has. The commentators point out that it closes a circle. The first line of the sound list, अइउण्, is where that अ was opened, and the last rule of the grammar is where it is shut.

The grammarians were proud of how little पाणिनि wastes, and they made a joke of it:

अर्धमात्रालाघवेन पुत्रोत्सवं मन्यन्ते वैयाकरणाः

Grammarians celebrate saving half a beat as if a son had been born. A मात्रा (mātrā) is the beat of a short vowel, and half a beat is a bare consonant. The joke shows the age it comes from, when the birth of a son was the happiest news a family could have, and it is told against the grammarians as much as for them. It comes near the end of a book on the grammar’s working rules by नागेश (Nāgeśa), and even he adds a caution straight after it: in rules of several words, what is weighed is mostly the number of words, not the half-beats.

One word, through the rules

To see the machine run, take a word everyone knows, भवति (bhavati), he is, he becomes, the kind of verb form Chapter 6 laid out in a table. In the grammar nobody simply writes it down. It has to be built, from the root भू, in steps, each done by a rule, and the grammar’s school versions show it built. The one below follows the लघुसिद्धान्तकौमुदी (Laghusiddhāntakaumudī), a short rearrangement of पाणिनि’s rules by topic made by वरदराज (Varadarāja) for beginners, and still taught.

Try it

Building भवति, one rule at a time

Each press of the button applies the next rule. The pieces in strike-through are markers on their way out; the shaded piece is what the rule just changed.

भू

  • 1.3.1 भूवादयो धातवः
Step 1 of 10

Start with the root भू, to be or become. It heads Pāṇini’s list of roots, and the rule that defines a root is named after it: “भू and the rest are roots”.

The action is happening now, so put लट् after the root. लट् is not a sound anyone says: it is a label meaning “present time”.

The अ of लट् (said through the nose) and its last consonant ट् are markers, and markers drop out. What is left, ल्, is a slot: “a verb ending goes here”.

One rule lists the eighteen endings that can fill the slot. Others pick one: the set for this kind of root, the “he” row since the doer is neither “you” nor “I”, the “one” form for one doer. That is तिप्.

The प् of तिप् is a marker too. It has told other rules what kind of ending this is, and now it drops out.

Verb endings like ति, and pieces marked with श्, are called सार्वधातुक. Before ति, when the verb speaks of the doer, शप् goes between root and ending.

The श् at the front of शप् and the प् at its end are markers, and drop out. Only अ is left, but the श् has done its work: it made this अ सार्वधातुक too.

The root now stands before a सार्वधातुक piece, the अ, so its vowel takes its गुण step. The गुण vowels are अ, ए and ओ, and the nearest to ऊ is ओ: भू becomes भो.

ए, ओ, ऐ and औ before a vowel become अय्, अव्, आय् and आव्. ओ meets the अ, so it becomes अव्.

Nothing is left to change: भवति, he is, he becomes.

What stands out is how much of the work is done by letters nobody ever says. लट् is not a sound in any word; it is a tag meaning “present time”, and its अ and ट् exist only so they can be dropped. तिप् carries a प् that tells other rules what kind of ending this is. शप् carries a श् at the front, and that श् does real work before it goes: it makes the piece count as सार्वधातुक, and that is what sends the root’s vowel up to its गुण step. The markers are switches. Each one sets off some rule further on and then disappears, and a reader who knows the switches can tell from a bare name like शप् or तिप् everything the grammar will do with it.

And the steps arrive at a word that Chapter 14’s joins already explained from the other side: ओ before a vowel opens into अव्. There, it was a pattern seen in words like पवन. Here it is rule 6.1.78, एचोऽयवायावः, the sounds of एच्, ए ओ ऐ औ, become अय्, अव्, आय्, आव्, applied at exactly the moment the derivation needs it. The same few rules make भवति, and with a different root and nearly the same steps, वदति, नयति and thousands of other verbs.

What computer scientists see

The people who wrote the first programming languages had a problem that पाणिनि would have recognized. A computer must be told exactly which strings of symbols are a correct program and which are not, and plain English descriptions kept leaving holes. John Backus, and after him Peter Naur, wrote the rules of the language ALGOL in a notation of their own: a name for each kind of thing, and rules saying what each kind can be made of, some rules naming themselves. The notation became known as Backus–Naur form, and in some form it describes nearly every programming language since. The site’s Grade 12 Computing chapter on grammars writes one and runs it.

In 1967 a computer scientist named Peter Ingerman wrote a short letter to the journal of the Association for Computing Machinery. His point was that Backus had not been first. A grammarian of ancient India, he argued, had described Sanskrit with a notation that could do everything Backus’s could, with its own ways of saying “or” and of naming kinds of things, and with the result written at the other end of the rule; Backus had found the idea again on his own. So Ingerman proposed a new name: Panini–Backus form. It never caught on, but it is why programmers who have never seen a word of Sanskrit sometimes know पाणिनि’s name.

Plenty of people who know the grammar well think the comparison sells पाणिनि short, or misses the point. The scholar Dominik Wujastyk put the case plainly when the letter was discussed among Sanskritists. A notation like Backus’s is a way of writing grammars down; the अष्टाध्यायी is a grammar, of one particular language, and far more subtle. Its rules don’t just describe, they operate. And पाणिनि very likely worked without writing at all, so even calling his system a notation stretches the word. To say that it is like Backus’s, Wujastyk wrote, comes down to saying that पाणिनि was logical, systematic and had a language for talking about language, which was no news even when Ingerman wrote.

The difference shows in the rules above. Backus’s rules say what can be made of what. पाणिनि’s rewrite one form into another in a given setting, in an order the grammar controls, with special rules overriding general ones and the rules near the end hidden from the rules before them.

Linguists see something else again. Many read the grammar as what they call generative: a finite set of rules that produces the endless correct sentences of a language and only those, the goal modern linguistics set itself only in modern times. Paul Kiparsky, who has spent much of his career on it, notes that each school of linguistics makes its own portrait of पाणिनि, and sets out to show that the careful describer and the generative grammarian are the same man. He is also careful to warn that in this field “practically everything” said about how the grammar works “is subject to challenge”. The rules are short, and the commentators have argued over what some of them mean for two thousand years.

None of this needs the grammar to be a computer, and it isn’t one. It is something older and in some ways harder: a way of making a whole language out of a list of sounds, a list of roots and a few thousand rules, built to be carried in a human memory and passed from teacher to pupil. The poet दण्डिन् (Daṇḍin), who wrote a handbook of poetry many centuries after पाणिनि, said what was at stake:

इदमन्धं तमः कृत्स्नं जायेत भुवनत्रयम्।
यदि शब्दाह्वयं ज्योतिरासंसारान्न दीप्यते॥

These three worlds would all be blind darkness if the light called the word had not shone ever since the world began.

Try it

दण्डिन्’s light of the word, unpacked

इदमन्धं तमः कृत्स्नं जायेत भुवनत्रयम्।

यदि शब्दाह्वयं ज्योतिरासंसारान्न दीप्यते॥

इदम् अन्धम् तमः कृत्स्नम् जायेत भुवनत्रयम् यदि शब्दाह्वयम् ज्योतिः आसंसारात् न दीप्यते

  • इदम् अन्धम् → इदमन्धम्. म् joins the vowel after it.
  • अन्धम् तमः → अन्धं तमः. म् before a consonant is written ं.
  • कृत्स्नम् जायेत → कृत्स्नं जायेत. म् before a consonant is written ं.
  • शब्द आह्वयम् → शब्दाह्वयम्. अ and आ make आ (Chapter 14), the two words made one.
  • ज्योतिः आसंसारात् → ज्योतिरासंसारात्. After इ, the ः turns into र् before a vowel (Chapter 13).
  • आसंसारात् न → आसंसारान्न. त् before न is said through the nose and becomes न्.
Meaning
this
Form
The doer, one, neuter, of इदम्, this; it goes with भुवनत्रयम्.
Meaning
blind
Form
Describes तमः, so neuter, one, like it: darkness that leaves you blind.
In Nepali
अन्ध, अन्धकार
Meaning
darkness
Form
The doer, one, of तमस्, a neuter word; with इदम् and भुवनत्रयम्, what the worlds would become.
In Nepali
तम
Meaning
whole
Form
Describes भुवनत्रयम्: “the whole of the three worlds”.
Meaning
would become
Form
Verb, the wishing form (Chapter 11), “he, she, it”, of जन्, to be born, to become.
In Nepali
जन्म
Meaning
the three worlds
Form
The doer, one, neuter: भुवन, world, and त्रय, a set of three: heaven, the air between, and the earth.
In Nepali
भुवन, त्रय, त्रिभुवन
Meaning
if
Form
Never changes.
In Nepali
यदि
Meaning
called “word”
Form
Describes ज्योतिः: शब्द, word, and आह्वय, name, “the light whose name is word”.
In Nepali
शब्द, आह्वान
Meaning
light
Form
The doer, one, of ज्योतिस्, a neuter word.
In Nepali
ज्योति
Meaning
from the world’s beginning
Form
The from-case of संसार, the world’s round of births, with आ, up to or from: “ever since the world began”.
In Nepali
संसार
Meaning
not
Form
Never changes.
Meaning
shines
Form
Verb, present, “he, she, it”, of दीप्, to blaze, to shine.
In Nepali
दीप, दीप्ति

If the light called the word had not shone ever since the world began, these three worlds would all be blind darkness.

Word by word: this blind darkness whole would-become three-worlds, if word-named light from-world’s-beginning not shines

A named work: Kāvyādarśa 1.4

Daṇḍin’s Mirror of Poetry (काव्यादर्श), a handbook of poetry, verse 4 of its first chapter, in the Bhandarkar Institute’s edition (Poona, 1938), page 4.

Daṇḍin, opening his book on why words matter.

It turns on यदि, if, with जायेत, would become, the wishing form of Chapter 11, doing the work of “would”. Two verses later दण्डिन् brings back the wish-cow of पतञ्जलि’s saying, with a pun the language makes easy. गौः means speech, and it also means a cow. Speech used well, he says, is a wish-granting cow; used badly, the same speech announces the speaker’s गोत्व, his own cow-ness: he is the ox.

What to take away is that the अष्टाध्यायी is a grammar of almost four thousand short rules, from वृद्धिरादैच्, which names the vowel step वृद्धि, to अ अ, which closes the short अ again at the very end. It works with the fourteen lines of sounds, a list of roots and lists of words, keeps its rules short by carrying words from one rule into the next, lets the special rule beat the general one and the later rule win a tie, and builds each word in steps, with marker letters that switch rules on and then drop out, as भवति is built from भू. Computer scientists saw in it an early cousin of the notation they use to define programming languages, and Ingerman’s Panini–Backus form is the famous suggestion; scholars of the grammar point out that it does far more than that notation, and that what it really is, a grammar built to make the correct words of a language and only those, is worth knowing for itself, without the comparison.

Found a mistake? Please tell us.