Sunday, August 30, 2009

Bed Bugs and Us...

“I finally found the proof of existence of bed bugs in our new house” – my roommate comes shouting with joy from his room. The joy on his face could be compared to space explorers just after having discovered life on Mars.
This discovery, howsoever trivial, was important. This single-handedly explained all the red marks and rashes on our skins. The bedbugs, our common household pests, have been like our pets for more than a year now. In our previous apartment, after having lived in denial for five months, we had found some small ant-like creature crawling on our bed and we threw away the bed immediately. The reason for shifting our apartment lay in confusion regarding the property deed between bedbugs and us. We thought that we had rented the apartment for a year, while the bedbugs insisted that we had encroached on their permanent residence. After seven months of bitter battle in which we lost litres of our blood, the bedbugs finally won and we came to our new apartment eight weeks back.
The new apartment, seemed a promising one with spick-and-span look, clean rugs and no sign of bedbugs, but itches and rashes started their surprise apparition on our skins all over again. I was living in denial till my roommate showed me a living proof of our tiny guests. In all these months of war with bedbugs, this was the enemy’s first soldier we had caught. Despite all the pent-up rage, we were faced with moral dilemma. I posed following question before him:

  1. Does Geneva Convention apply in this case?
  2. Should we treat this single bug as a prisoner-of-war or put charges of waging war against us and treat accordingly?
  3. If prisoner-of-war, PoW for short...
The last question is deliberately left incomplete because at this point my roommate picked up his slippers and literally beat the pulp out of the bedbug in question while murmuring choicest of abuses in Hindi. R.I.P. bedbug!

Krishna Preachings

It’s been a little more than a year that I have been going to Krishna Lunch at Florida. The meal is tasty and really cheap – 10 meals (now they have reduced it to 9 meals) for $30. Beginning 2009, I came to know about Krishna Dinner (though they write it as Krsna Dinner – awful transliteration) every Friday, which is for free. The catch is, you need to listen to their pravachan (preaching) for about an hour and half. While some enjoy it like a story, some listen to it faithfully like word of god, few call it “payment” for free meal, and some take it as suffering they need to endure for manna. I, maybe there are few more like me, take a critical view of the whole sermon. So critical that if I were ever to express it in front of them then there is very high chance that I won’t be welcome there anymore.
I start with an old joke, but before that some background for uninitiated. It is said that uncle of unborn Krishna, called Kans was steering the chariot of newly wedded Devika (Krishna’s mother) and Vasudeva (her husband). While driving the chariot, a prophecy was made that eighth son of Devaki and Vasudeva would kill Kans. So, Kans imprisoned his sister and brother-in-law and started killing Devaki’s children. The joke goes thus: that if Kans knew that his sister’s eighth child would kill him, then why did he keep his sister and brother-in-law in same cell? No Krishna devotee has ever been able to answer that… and yes, Hinduism does not believe in virgin birth.
So, Krishna grows up, and since he is God himself, girls start falling in love with him. In all of the painting and photographs, Krishna is showed alongside Radha. The two of them are idolized together and prayers and hymns have their name together. Reader might be tempted to think of Radha as wife of Krishna, which is absolutely wrong. Krishna’s wife is Mandodari (and ten thousand more) but not Radha. So, was Radha mistress of Lord Krishna? No again, Radha was married to Ayan. Then isn’t it T adultery by God himself? if I were to pose this question to preachers, then they’ll probably answer that God can indulge in adultery because he is God! Right ho! Q.E.D.
Then they preach about benefits of vegetarianism. Vegetarianism is good, I am a vegetarian myself. However, their reasons for being a vegetarian are farcical, absurd, preposterous and derisory. They say that we accumulate negative “karma” (deeds) because of killing animals. If that is correct, then aren’t we killing the plants too? Isn’t there any negative karma about that? It’s like changing methods of capital punishment in name of making it humane and less painful. It may be humane and less painful, but not for the condemned, instead for those who watch the condemned die. For all we know lethal injection may be more painful than beheading, but the witnesses do not see the gore so it is alright for them. Same is with plants, death may be painful for them too but since we do not see any suffering it’s ok to eat a dead plant. For animals, that is a different matter, they make noises – it’s gory to watch that.
This has really made me curious about religion and its various interpretations. The god they pray openly committed adultery; we do not have any proof that he did not eat meat; he certainly did not preach monogamy because he himself had 10,000 wives. When we hear the ISKCON interpretations they are paradoxical, in fact, they go diametrically opposite the path God showed us. Are the interpretations asinine? I should say no, the literature is written by most learned people of that time. Then is the interpretation correct? I am not sure about the correctness, but I am not in position to refute them altogether. You answer.

Tuesday, August 11, 2009

How to build a interpreter? - 1

I recently got a project to build an interpreter for RPAL. The first part of project was to build a 'scanner/lexical analyser' and then make an Abstract Syntax Tree for that. So far so good, but when I went ahead to create a scanner most of the help on the internet said that scanner is a deterministic finite automata and blah blah blah...
So, I decided to write something myself in the hope that people will find it useful. Here's a sample grammar, very small so that it doesn't inflate the post size and yet enough to show all the concept. Oh, and by the way, this will be a LL(1) parsing technique, which means we will be reading the file (which we need to scan) from left to right, and creating the tokens from left to right and we may sometimes look one character ahead to decide exactly which token to formulate.
We will also be taking care of some standard issues such as left-recursion.
In next post: The grammar