a dsl for sanskrit / panini techniques

63 views
Skip to first unread message

Vasu Srinivasan

unread,
Nov 19, 2011, 11:43:58 AM11/19/11
to sanskrit-p...@googlegroups.com
here is an attempt to create a domain specific language for some techniques of ashtadhyayi. I was long convinced that creating a dsl will simplify how we do lexical and syntax analysis. Using meta-programming and other dynamic-programming techniques seems to have a tremendous advantage over regular/traditional programming techniques. its in groovy, but could have very well be written in ruby (which has more metaprogramming support i feel) etc. also if it has to be truly integrable with other systems, groovy makes it trivial to expose such operations as a webservice.

the dsl could be easily expanded and with some sophistication, such analysis in sanskrit could grow in its own domain environment

criticisms welcome.

http://vagartham.blogspot.com/2011/11/chapter-8-dsl.html


--
Regards,
Vasu Srinivasan
-----------------------------------
vagartham.blogspot.com
vasya10.wordpress.com

vishvAs vAsuki

unread,
Nov 19, 2011, 12:32:08 PM11/19/11
to sanskrit-p...@googlegroups.com
atyuttamaM - mE visheShataH Etat rochate - sivaSutra.'At.' + sivaSutra.ic.



shIghraM Eva Etat api prApnuyAt!

1
assert "bhavati" = bhU + sap + tin //1st gana

1
assert "kasca" == 'ka:' + sca //scutva sandhi


asmat-sadRRiShEbhyaH EvaM gaNakAdeshamAdhyamEnaiva saMskRRitAvagamanaM sulabhaM.

sarvatra log.info("lasaku (ataddhite)") iti AdEshAn samayujiShyat chEt, yantrOpayoga-sandarbhe sUtra-pramANAni api alabhiShyan!

--
vishvAs

Vasu Srinivasan

unread,
Nov 29, 2011, 11:40:05 AM11/29/11
to sanskrit-p...@googlegroups.com
@vishvas mahodaya

somehow I missed reading your reply....

so yeah, the idea behind the "samskritam-dsl" is to eventually allow non-programmers use this kind of simple language to come up with lexical/syntactical constructs. Right now the code is all meta programming and there is not really any "dsl" per se. But that is the eventual goal - to create a dsl that will be usable by non-programmers too in an interactive fashion. And expose several of these functionalities as a webservice.

Anyway I finally checked the code into github with a few more enhancements - like converting a text to unicode etc, some more samjna sutras, direct iteration of varnas on a string (instead of going through a list everytime). For eg 'kr.s.Na:'.each { it } will yield each varna - k, r., s., N, a: -> really useful if and when using itrans scheme which has multi-chars like R^i, LLI etc... 

The Main.groovy contains the test cases.. For eg we can now do like 'suklAmbaraD.aram'.unicode() and it will result in unicode शुक्लांबरधरं . 

The git repo is https://github.com/vasya10/samskritam, the project is samskritam-dsl, has eclipse settings and needs groovy-1.8.4. if using eclipse, highly recommend installing the plugin SpringSource toolkit called STS.

Personally I tried similar stuff in java a few years ago and after creating several wrapper classes, iterators, interfaces, patterns, I just gave up. It was just too verbose and not worth the time. Groovy helped accomplish the same in just a couple of weeks, besides providing some great meta-programming capabilities. 

yes i do plan to start using log4j soon. 
Reply all
Reply to author
Forward
0 new messages