Panini’s Linguistic Metaverse: Was Panini a Programmer?
- CIKS Anaadi
- May 3, 2025
- 10 min read
Updated: May 4, 2025
Part two of a three-part blog on Panini's Ashtadhyayi and computational linguistics by CIKS fellow, and academic Shagun Sinha, for the modern reader.
I can see you asking this question now - So, you want me to believe Panini was a programmer?
Good question, you!
Quick and short answer, yes. But the long answer is even better. Ahem! So, after the first blog, you now have a general idea of who Panini was. His predecessors are also kind of known to you now. We left the discussion - (my monologue actually. Ah I speak so much!) - at the point of brevity which the idea of saying more in less. I pick up the discussion in this blog from that very point. When you can say a lot in fewer words, you are considered a scholar. Brevity is elegant. Having a way with words is an art only some have. This art is expected to be mastered by computer programmers too. If Panini were a programmer, he must also have known it. In the previous blog, I touched upon the technical term for brevity, called laghava. But what exactly do I mean by laghava being a component of computer programming? And how does Panini achieve it to be called a programmer?
In this blog I pose that question on your behalf - What makes Panini a programmer and hence the Ashtadhyayi, a text of marvel? The answer, as you will see, is Panini’s metalanguage. By the end of this post, you will gain an understanding of Panini’s metalanguage, his tool of marvel.
Background
Recall that school period when you would remove your shoes to enter computer lab. Your teacher would teach the basics of computers and help you understand how computers work. Unless you were busy playing Minestroke or figuring out WordArt on MS word during their lecture (Hey you, millennial! I get you ;)), you would remember the basic definition of a computer program for the simple reason that every computer teacher in the early 2000s made their students parrot the holy definition unendingly, “A computer program is a set of instructions given to a computer to perform an action.” And action in this definition could be anything from simple addition to manipulating a user input to display an image, text, etc.
When you program a computer to take two inputs and add them - if the user demands - you do not tell it every possible number that it can encounter for addition. You simply tell it something like ‘if you get one integer x and another integer y, you have to add them and give the output.’ And just like that, you have given an idea of the entire universe of numbers in one line - ‘an integer x’. Such ideas of shortening instructions are taught to would-be programmers, two of them being - Abstraction and Encapsulation. To represent only the essential parts of an object is called abstraction. Likewise, encapsulation refers to grouping similar or related entities into one form, class. In other words, when you put similar things into a class, as if putting everything in one capsule, you are said to be encapsulating them all. These are two of the few other prime concepts in programming which insist that a computer program deploy brevity. Needless to say, these are basic building blocks of programming.
Similar basic blocks have been deployed by Panini in presenting the rules for Sanskrit grammar in Ashtadhyayi. Panini’s Ashtadhyayi is a textual program. It aims to present rules for forming and analysing words. Say, unhappy is made up of ‘un’ and ‘happy’. By analysing ‘unhappy’ and its components, I have made an attempt to analyse English. Panini has done similar work in Sanskrit. The Ashtadhyayi lists rules for words of Sanskrit like ‘if you get a word A and a word B, perform an action C to get output D’. It is not the formulation of rules but the manner in which these rules are composed that calls for applause. Panini uses as few words as possible to convey these ideas. And you guessed it right, if it really were possible to use fewer words than what we usually do to formulate these rules, why not use those fewer words always? If Panini could do it, so can we. Except, Panini did not use fewer words of the usual regular language (obviously we would use it then). He devised a new language altogether - his metalanguage. And this metalanguage helped him shorten the words without losing out on the essence and substance of his analysis.
Seed of Panini’s Metalanguage: Maheshwar Sutras
A set of 14 rows of phonetically arranged sounds called the Maheshwara Sutras is the cornerstone of Ashtadhyayi. It may be called the Sanskrit Alphabet arranged according to the requirements of AS’ rules. The first four rows consist of vowels whereas the remaining 10 rows consist of consonants.
अइउण्
ॠलृक्
एओङ्
ऐऔच्
हयवरट्
लण्
ञमङणनम्
झभञ्
घढधष्
जबगडदश्
खफछठथचटतव्
कपय्
शषसर्
हल्
The sounds are so arranged that all vowels are grouped together and all consonants are placed together. Even within each row, the arrangement of letters is as per an order. Panini does not use the usual varnamala sequence of letters that we learn of in India (अ आ इ ई…क ख ग…etc.). Instead he rearranges the letters to suit his goal of forming rules. He uses the Maheshwara Sutras to have Pratyaharas or abbreviations, and then uses these abbreviations for making rules.
For example, the first set of letter above - अ इ उ ण् - is collectively called अण्; By using अण्, Panini refers to all the elements encapsulated under अण् namely, अ, इ, उ barring ण् which is a marker and is not supposed to be counted.
<aside> 💡
Metalanguage - language about language
अण् is not a regular-occuring word in Sanskrit. Instead it is Pratyahara which comes from the Maheshwara Sutras which represent sounds of Sanskrit. अण्, like the other Pratyaharas of the text, helps in describing Sanskrit. Therefore, It is a language which describes another language. The system of Pratyaharas and related linguistic devices together compose Panini’s Metalanguage.
</aside>
“Aśṭādhyāyī is a system (śāstra) of nearly 4,000 rules (sutras) distributed over eight books with four quarters (pādas) each. Since rules are structured with utmost brevity and algebraic condensation, and also since the explicitness condition of their formulation demands clarity and no confusion, Pāṇini chose to present them with the framework of a meta-linguistic theory most conducive to their interpretation and application. He not only formulated his rules with terms and symbols but also furnished them with some interpretive conventions whereby, with systematic application of rules, one would present a formal analysis of correct Sanskrit usage” (Sharma 62)
Recall that the AS is presenting rules about word formation in Sanskrit including how two words may interact with each other. Hence, it will need to refer to these individual sounds for stating the rules.
Other Linguistic Devices
A parallel between Maths and Sanskrit will help understand the nature of Panini’s text. Trigonometric formulas in Maths are well known to all:
sin^2 ■ + cos^2 ■ = 1
Recall that we have learned of Sandhi rules in language in a similar pattern:
<aside> 💡
maha + aatma = mahaatma
Or simply, a/aa + a/aa = aa
</aside>
We have always learned word rules in the pattern of such mathematical formulas too. Today, 2000 years after Panini, we find it easy to remember word rules such as above. We are used to symbols like “+” and “=” to represent word formation. We learn it through these representations.
While the Sandhi rule above may look like a rule anybody could have come up with (because we have become used to such representations of rules), what must be noted is that in the Ashtadhyayi, it is one of the nearly 4000 rules. All of these sutras deal with similar interactions of at least 200 sounds within a majority of Sanskrit words. Panini did not only observe a large corpus of spoken words and Vedic mantras to list their formation as rules but also formulated an Alphabet arranged in a way that can accurately aid in forming those rules with precision.
To think of this 2000 years ago using no computers but language is what inspires the awe of many towards Panini. Instead of using mathematical abstraction symbols like “+” or “-”, Panini used linguistic devices as his metalanguage, the key of which are the Pratyaharas. He is performing Maths on words by using words themselves as operators. No doubt, he is regarded as a linguistic genius. He creates abbreviations out of sounds and then treats the abbreviations as words as usual to form rules. For example, to say that ‘a’ and ‘a’ will be replaced by ‘aa’, he says
‘a’-of (a word) (followed by) ‘a’ leads to ‘aa’ (being the replacement)
His grammar uses words and phrases like ‘of’ and ‘followed by’ as markers which indicate Sandhi points. Within the framework of Ashtadhyayi, these words from everyday language acquire a different meaning - and they need to be read with those meanings. Six types of rules or sutras help a learner comprehend these meanings, namely, Sangya, Paribhasha, Vidhi, Niyama, Atidesha, and Adhikara sutras. Their comparison with the different aspects of programming has been tabulated below. See Kapoor’s Dimensions of Panini Grammar for more details.
Type of Sutra | Its task in AS | Comparability with Programming |
Sangya | Assigns names to entities | Variable assignment |
Paribhasha | Provides solution in case of conflict | if-else or exception handling |
Niyama | Offers solution in case of digression | if-else or exception handling |
Vidhi | Performs an action on an entity | Methods & Functions along with their arguments |
Atidesha | Assumes one entity to be like another | Variable assignment of the type x = y, y = z etc. |
Adhikara | Declares the beginning of a topic | Variable declaration, class declaration |
Table 1: Sutras and Programming Terms
Anuvritti
By using another metalinguistic tool called Anuvritti, he omits repeated words to ensure minimal word use without losing out on the meaning of the rules.
Import statements in Panini
Relatedly, Programming also uses import statements - Panini regularly imports from the metaverse of his linguistic compositions - the 5 hallowed texts namely, Dhatupatha, Ganapatha, Phit-sutras, Unadisutras, and Linganushasana. These additional reference lists are often imported by Pāṇini and used as required. This adds to the list of programming-like elements used by Panini.
Seed of Sanskrit and Artificial Intelligence: Rick Briggs’ Paper
In the early 1980s, much much before ChatGPT and Elon Musk’s Optimus, AI was far away from the forms we know of today. AI researchers were trying to present a model of world knowledge on which “artificial intelligence” of machines could be developed. Since AI is expected to be the machine-counterpart of humans (and their world knowledge), researchers were focused on representing the humans’ world knowledge for the machine in a compact way. In other words, by creating represented knowledge, people were trying to bring machine knowledge at par with human knowledge. Other technological developments were also on their way, but for that time and era, this KR was crucial.
Rick Briggs, a NASA researcher published a paper in a journal called “AI Magazine” in which he suggested that Sanskrit grammatical tradition has elements of knowledge representation (KR) that the Artificial Intelligence groups of that era could take cue from for building similar KR models. It is for KR that Briggs proposed having a look at Sanskrit scholars’ style of representing knowledge - which, coming from Panini’s tradition, Sanskrit grammarians did through the means of brevity. And that was pretty much about it.
In the interest of time and space, I do not expand any further (Do read Briggs’ paper). But the idea I want to drive home is that this paper suggested a probable relation between Sanskrit and AI which was highly relevant to the AI of that decade. In today’s time, AI has far exceeded that technology and is highly advanced. It does need KR but has advanced means of doing it. Data is the new oil and AI is absolutely mining it.
To my best knowledge, this paper is where those Whatsapp rumors of NASA working on Sanskrit began. Briggs was associated with NASA but that barely tells us anything further about NASA’s work in this direction. New papers of similar connections between Sanskrit and AI may still come out. But the relevance of that paper is now limited.
Conclusion
This blog began with a query - what makes Panini’s text comparable with a computer program. The answer is his metalanguage. Here is a summary of his metalanguage and why we consider his text algorithmic, i.e., a text with a program-like structure:
List-like arrangement of letters on the basis of place of articulation.
Formation of capsule-like Pratyaharas of these letters which helps represent many letters using one name
Use of Pratyaharas to make rules regarding member letters in a manner that the respective position of letters within one pratyahar becomes significant when dealing the members at the same places in another pratyahara making one marvel at the skills of pattern-recognition and sound arrangement of Panini.
Rules follow internal structure - rules based on one theme which are likely to reuse a word are grouped together with minor exceptions.
Words repeated across consecutive sutras are omitted after first occurrence without much interference in meaning.
Additionally, I tried to bust that holy rumour about Sanskrit and AI. You know that the core is at Rick Brigg’s paper. You know the possibilities and limitations of that paper now.
I want to end with one final query for thought - if Briggs’ paper is no more relevant, does Sanskrit even have anything to do with computers anymore? Does Sanskrit hold any links with Computers, if not with AI? I have indicated the answer in this and the previous blog. Wait for the final blog to know where all of this is leading.
References:
Sharma, Rama Nath. Paninian Tradition of Grammar and Linguistics. D K Printworld.
Kapoor, Kapil. Dimensions of Panini Grammar. D K Printworld: New Delhi, 2005.
_____________. Text and Interpretation. D K Printworld: New Delhi, 2006.
Despande, G T. Pre-Paninian Grammar. Popular Prakashan. New Delhi: 2011.
Kiparsky, Paul. Add complete reference.
Briggs, Rick. “Knowledge Representation in Sanskrit and Artificial Intelligence”.
Ashtadhyayi: https://ashtadhyayi.com/sutraani
This blog has been created as part of the CIKS Summer Fellowship 2024. Each fellow will share a series of blog posts summarizing their projects from the fellowship. Keep an eye out for the exciting work the fellows are doing.
Meet the Author: Shagun Sinha

Dr. Shagun Sinha works as an Assistant Professor of Sanskrit at Amity University, Noida. Her research interests span across Paninian grammar, computational linguistics (CL), and language pedagogy. She completed her PhD in Sanskrit with a focus on CL from Jawaharlal Nehru University last year and worked briefly at an AI startup in Bangalore before commencing her journey as an Assistant Professor.
At CIKS, Shagun is working on a comprehensive literature survey in Paninian grammar and CL. The resultant survey will list the major research works, problem areas in the interdisciplinary field of Paninian grammar and CL to serve as a comprehensive guide for future researchers.
