how/why sanskrit is suitable for programming computers

127 views
Skip to first unread message

peekay

unread,
Nov 4, 2009, 9:09:41 AM11/4/09
to Scientific and Technical Hindi (वैज्ञानिक तथा तकनीकी हिन्दी)
more on why sanskrit is suitable for computer coding .. '
view of prof. Lakshmi Thathachar, melkote, india


from : http://www.goodnewsindia.com/index.php/Magazine/story/melkote-sanskrit-academy/P3/



for those who are in the programming profession OOP
is the key word


for those who are not in the programming profession,
Object Oriented Programming is a method of coding
where 'classes' are a quality ascribed to "objects"


"The current time in human history is ripe, he feels for India's young
techno wizards to turn to researching Mimamsa and developing the
ultimate programming language around it"


It was Panini who formalised Sanskrit's grammer and usage about 2500
years ago. No new 'classes' have needed to be added to it since then.
"Panini should be thought of as the forerunner of the modern formal
language theory used to specify computer languages," say J J O'Connor
and E F Robertson. Their article also quotes: "Sanskrit's potential
for scientific use was greatly enhanced as a result of the thorough
systemisation of its grammar by Panini. ... On the basis of just under
4000 sutras [rules expressed as aphorisms ], he built virtually the
whole structure of the Sanskrit language, whose general 'shape' hardly
changed for the next two thousand years."
Every 'philosophy' in Sanskrit is in fact a 'theory of everything'.
[The many strands are synthesised in Vedanta --Veda + anta--, which
means the 'last word in Vedas'.] Mimamsa, which is a part of the
Vedas, even ignores the God idea. The reality as we know was not
created by anyone --it always was--, but may be shaped by everyone out
of free will. Which is a way of saying --in OOP terms-- that you may
not touch the mother or core classes but may create any variety of
instances of them. It is significant that no new 'classes' have had to
be created. Thathachar believes it is not a 'language' as we know the
term but the only front-end to a huge, interlinked, analogue knowledge
base. The current time in human history is ripe, he feels for India's
young techno wizards to turn to researching Mimamsa and developing the
ultimate programming language around it; nay, an operating system
itself.

peekay

unread,
Nov 29, 2009, 11:39:49 PM11/29/09
to Scientific and Technical Hindi (वैज्ञानिक तथा तकनीकी हिन्दी)
one more write-up from :
http://vagartham.blogspot.com/2009/11/sutra-based-programming.html

(this is just an example .. and should be treated as such ..
it is NOT an authoritative paper presented at any forum
but it does lead one to think about 2 things ..
1. is sanskrit suitable for programming computers
2. is there a similar "programming" in ancient texts ?)





subject : Sutra based Programming


To demonstrate the power of the language, let us look at a simple
program using a pseudo-language.

//Pseudo-code to produce a random number and determine if its odd or
evens = 100;r = (int) rand(s);if (r / 2 == 0)return "even";elsereturn
"odd";The question is, can this program be expressed using natural
language? Of course, we can write the whole program in plain English,
but it wont be concise.

Now lets apply the Sanskrit grammarian Paninian rules. I am going to
keep the function names as is (in bold), but conjugate the variable
names per Sanskrit rules (taking them to be consonant ending
variables).

1: aSeSha: SUnyam // No remainder 0 (No remainder equals 0)
2: s Satam // s Satam asti (s is 100)
3: sa: rand r // of s random is r (r is random of s)
4: int ca // int also (r is also int of random of s)
5: even ra: aSeshe dvibhAjane // "even" is of r during division of 2
when no reminder happens (on division by 2 of r has no reminder, it is
even)
6: odd SeShe // "odd" when there is a reminderHere are the
sutras in proper Sanskrit:अशेष: शून्यम् |स् शतम् |स: वृथा र् |अभिन्न:
च |समं र: अशेषे द्विभाजने |विषमं शेषे ||

As you can see there are absolutely no mathematical symbols! A program
is written purely by the expressive power of language. So what
happened? How are they equal?

Using nominative case and the implicit "is", Panini eliminated the
need for equals sign. Functions are defined via genetive case. Using
the locative case, Panini provides the if-else condition. In effect,
mathematical expressions are substituted by simply conjugating the
variables.

That is the genius contribution of Panini to Sanskrita! Now a skilled
poet could come and rearrange the above 6 sutras into a sloka format,
and lo! there is sloka that tells us how to determine an even/odd
number!

Let me attempt a half-baked sloka (May Sanskrita enthusiasts forgive
me for such a blasphemy).

अशेषो शून्यं भूयात् सेकशतं वृथा रेफ: स: ।
अभिन्नश्च द्विभाजने विषमं समं शेषोऽशेषे ॥

Due to the occurrence of words like SeSha, SUnyam, aSeSha, dvibhAjane,
abhinna the above can be mis-interpreted to refer Adisesha, SUnyavAda,
Vishnu, Dvaita, Advaita etc. Now we have an example of a sloka
referring to the gods and a mathematical algorithm encoded in it!

peekay

unread,
Nov 30, 2009, 12:02:39 AM11/30/09
to Scientific and Technical Hindi (वैज्ञानिक तथा तकनीकी हिन्दी)
a nice perspective and a practical comment
(as against the too much noise about suitability
of sanskrit for computers without knowing why)


from : http://vagartham.blogspot.com/2009_11_01_archive.html


"Myth 4: Sanskrit is the perfect language, mother of all languages and
best suited for computers"
<snipped>
What is suitable for computers is the APPROACH that Panini took to
define a natural language such as Sanskrit, as derivable from formal
rules. No other natural language is buffered by such formal rules.
That METHOD is very algorithmic, NOT the LANGUAGE itself
<snipped>

(capitalization by me)

peekay

unread,
Nov 30, 2009, 12:06:34 AM11/30/09
to Scientific and Technical Hindi (वैज्ञानिक तथा तकनीकी हिन्दी)
to emphasize the "code"

Here are the sutras in proper Sanskrit:

अशेष: शून्यम् |स् शतम् |स: वृथा र् |अभिन्न:
च |समं र: अशेषे द्विभाजने |विषमं शेषे ||


and the conversion to a verse :

अशेषो शून्यं भूयात् सेकशतं वृथा रेफ: स: ।
अभिन्नश्च द्विभाजने विषमं समं शेषोऽशेषे ॥

सुरेश कुमार शुक्ल

unread,
Nov 30, 2009, 11:52:31 PM11/30/09
to technic...@googlegroups.com
मैंने compiler design and Backus-Naur grammar form programming
language grammar पढ़े हैं।

जब पहली बार पातंजलि योगसूत्र पढ़े तो लगा कि भारत में आज से कितने साल
पहले यह इस्तेमाल में थी।
पहले अध्याय में ही एक एक योगसूत्र compiler grammar की तरह आगे बढ़ते हैं।

वैसे अष्टांग योग के मूलसूत्र और धर्म (बिना पूजा पद्धति और एक भी देवता
के जिक्र के) को जानने के लिए यह पुस्तक बेजोड़ है।

-सुरेश

३० नवम्बर २००९ १०:३६ AM को, peekay <pksharm...@gmail.com> ने लिखा:

pk sharma

unread,
Dec 1, 2009, 10:44:42 AM12/1/09
to technic...@googlegroups.com
An interesting application of definition of "sutra" to names
of objects/variables/constants/functions in computer code

from : http://vagartham.blogspot.com/2009/11/sutra-based-programming.html'

A Sutra for Naming Conventions


Many have heard of Patanjali's yoga sutra, Brahma sutra, Panini sutra etc.
Literally it just means 'a thread'. But what is it really? What qualifies as
a sutra? When does a sentence become a sutra?

It turns out, there is a definition of sutra. A sutra must exhibhit all 6
characterists to be called so. What are they? As usual the Sanskrit
grammarians have come up with a verse that defines a sutra.

alpAkSharam asandigdham sAravat vishvato mukham |
astobham anavadyam cha sUtra: sUtravido vidu: ||

अल्पाक्षरम् असन्दिग्धम् सारवत् विश्वतो मुखम् ।
अस्तोभम् अनवद्यम् च सूत्र: सूत्रविदो विदु: ॥

Source: vaayu puraaNa (anytime before 500 BC)

alpAksharam - Concise
asandigdham - without any doubt ie unambiguous or should have a singular
meaning that is conveyed
sAravat - meaningful, ie should not contain gibberish
vishvatomukham - Properly applicable
astobham - devoid of 'stobha' (kind of fillers in Vedic chanting) like hA hU
anavadyam - irrefutable (na avadyam - that which cannot be refuted)

people who know a sutra, know it so.

Now, how does this apply to a programming style?

One of the hardest thing to do in software development is to understand
others' code. Every developer would have come across some body else code and
claimed it as 'the ugliest piece of code ever seen in life'.

What is an ugly code actually? In general, a hard to understand, spaghetti
type code can be considered an ugly code. Typically lot of confusion arises
from what the developer is trying to convey by means of the names of
variables, classes, methods etc. A novice developer names a variable based
on what he or she thinks. An experienced developer names a variable as how a
novice would understand it without effort. In general the Shakespearean
quote "Whats in a name?" just does not apply to programming. A rose may
smell the same even if its called dog-poop, but its definitely a code-smell
if naming conventions are poor.

Lets see how each characteristic of this ancient definition sutra applies to
naming convention.

alpAksharam: Must be concise.
For eg. age, firstName, addressLine1 etc.

asandigdham: Must be unambiguous.
Eg. temp: What does it denote? A temporary variable? temperature? template?
Eg. Either use 'login' or 'logon' everywhere, but do not mix.
Eg. getReg(): What does it return? Registration? Registry? Regular
Expression?
Eg. code, date: What kind of code? What kind of date?

sAravat: Pithy; Meaningful; Should not contain gibberish
eg. clr; tmpk; fru; stp, lzp. Combining this with the alpAksharam and
asandigdham rules - will give a proper meaningful name.

vishvatomukham: Properly applicable
For eg, a variable name must have a proper scope. Eg. avoid local method
variables having same name as member variables.

astobham: Devoid of unnecessary characters.
Bad eg: intx, a_b_c; Believe me, there are programmers who do this just to
confuse others.

anavadyam: Flawless; Irrefutable
A naming of a variable or a class must describe exactly what it says.
Another developer should not be given a chance to say "Why didn't you name
this differently such that it is understandable?"

peekay

unread,
Dec 2, 2009, 11:39:51 AM12/2/09
to Scientific and Technical Hindi (वैज्ञानिक तथा तकनीकी हिन्दी)

-----------------------------
सुरेश कुमार शुक्ल :

मैंने compiler design and Backus-Naur grammar form programming
language grammar पढ़े हैं।

जब पहली बार पातंजलि योगसूत्र पढ़े तो लगा कि भारत में आज से कितने साल
पहले यह इस्तेमाल में थी।
पहले अध्याय में ही एक एक योगसूत्र compiler grammar की तरह आगे बढ़ते
हैं।

----------------------------------

could you please give a more detailed description about this ?

Reply all
Reply to author
Forward
0 new messages