BLOG (pre-midsems)





Today we came to the end of our series of free periods, as the Compiler classes finally started off. On the very first day, within the first 10 minutes of the class, our new professor caught everyone’s attention with the attendance itself, where instead of just the name and rolls he asked us our residence halls and home towns as well!! It kept us wondering whether there is any sinister motive behind this or not.


We had a discussion about how words in one language cannot always be translated into another language. Lots of interesting ideas started flowing in, which ultimately turned into a ruckus with everyone babbling, but no one making sense to the other!!!


There were also further discussions about what sort of languages can be compiled. The languages that we usually deal with fall into the category of Context Free Languages as they have a corresponding Context Free Grammar (CFG) associated with them. Natural Language Processing is very tough because spoken languages like English, Hindi, etc are not context free languages, which is why there might not be 1 to 1 correspondence between the source and the target language of the compiler.





The usual boredom of dep classes had started to seep in, and as usual ppl began to fall asleep.


As our professor advanced from one topic to another, when he was explaining the basic idea of code generation, a weird sort of misunderstanding crept in. We thought we heard sir saying 3 address code is due to 2 operands and a operator ...but after a few confused minds raised doubts, it was cleared.


Then there were discussions on why C is better than C++ (more optimizable), and other related fields of compilers.... Is a macro and an inline function the same?? And as usual hardly few bothered to think about it.




As the class went on, we were asked to represent "identifiers" using regular expressions. Then the class started getting a bit more interesting...that is ppl started waking up :P and clambering for a bit of attention with Diggi and Aneesh going up to write on the board...which turned out to be wrong (rare case but happens)..... And when Kunal, TD and few others were jumping to tell what they thought was the "correct" was then when Sir announced THE MINI ASSIGNEMENT SCHEME ... instead of giving answer in class we have to mail it to him at 7pm and he would only consider the first 5 correct answers.





The class started with lots of whispering  ... "did u mail him that assignment?" But as everyone expected, hardly few...only the maggu nuts cared to mail.


Sir continued the discussion on regular expressions....expressions for email ids. Then the 2nd chapter of his Mini Assignment Scheme came up.....with a regular expression for ip addresses. This is when everyone started taking sir seriously.....and the result was the class started to turn chaotic.

Sir said that we were supposed to mail him the answer at a particular time SHARP....and only the first 5 mails…with correct answers of course, will be given marks. So this mini assignment scheme turned out to be a very "sophisticated" form of a lucky draw!!! God only knows who mails first and whose mail reaches sir's inbox first!!!

And that too 5 ppl out of a batch of 60!!!

More details to his innovative ideas kept pouring in....How was he supposed to judge the 7 pm mark?? He would mail himself (according to his own standard time [NST] :P ) at 7pm, only 5 subsequent correct mails  will be considered.


No million dollars for guessing that the whole class started protesting. Who would want to play KBC without Amitabh Bacchan and three life lines???


Enough for this day....too eventful to stop writing. :D






Today the class started with interesting feedback from sir about our Mini-assignment submissions, in which few ppl were so enthusiastic about being the LUCKY ONES, that they just didn’t mind filling up sir's mailbox with 15 copies of the same mail.

He started explaining to us the format of a lex file....and soon the compiler class was transformed into a Greek and Latin class (or German and Italian, maybe).

And finally the class ended in English, when sir gave the mini-assignment 3.




Today we realised how easy it is for us to generate all sorts of errors, and how tough for the poor compiler to recover from them.


It was also revealed to us that the human brain has an attractor point (don’t ask what all it can attract :P), which can figure out jumbled texts and extract meaningful forms out of them, which is a theoretical basis of Global Error Correction.


We also came to know that we can earn extra mini assignment points, when Hrishikesh was able to match the unmatchable, or in simpler words, solved the ambiguity of if-else statements.




The attendance in the class began to dwindle. And whatever was taught in today's class was quite clear.





Today sir presented us a "magic" table to parse a grammar. It was simply given to us, with a promise that he will explain the secrets to its "magical" nature later. But it did wonderfully parse the "sample grammar" - from which the table was made.


And interestingly many ppl left the class before sir realised that he had to give the mini assignment and to everyone's relief there was no mini-assignment on that day :)!!!




Today the class started with the mini assignment, as sir did not want to take any chances that might lead to situations similar to the previous class.


And finally today, the magic tricks of constructing the table were revealed and we began developing sound ideas of what a parser actually does behind the curtains.


we also had an interesting debate in the class regarding the precedence of operators. It was said that in an ambiguous grammar like E -> E + E | E - E | id, since + and - have the same precedence, the order of processing of the operators in the parse tree (due to ambiguity it will have multiple parse trees) will not affect the end result. But as it was pointed out by TD, there is still a conflict that arises due to the ambiguity, and an expression like 3-5+4 can produce 2 or -6 as the result, depending on the parse tree we choose. The conflict was resolved by considering the associativity of the operators.


This fetched TD an extra point and the whole class – an welcome break in the double period :P.





The class turned out to be a highly serious one as Sir continued to explain about Operator grammar and stuff…And when sir was trying to distribute the 20 marks for TA, Mukesh came up with the idea of a class test.




The classes are now taking a more serious turn as ppl started attending the class more regularly. Exams are approaching and nobody has any idea how far is the syllabus for the midsems, which is probably why ppl are trying to concentrate in class in an attempt to understand what is being taught.


Another intuitive point of discussion was on why LR parsers are more powerful than LL parsers. LR parser use the bottom up approach and use left to right scanning and rightmost derivation technique, thus allowing left recursive grammars, unlike LL parsers.




Today sir presented his vision, another of his innovative ideas, of starting and maintaining a "Community Service" wherein we will have lecture notes prepared by randomly picked students (roll numbers generated by a random number generator)and also blogs, again prepared by certain students (randomly picked by sir, in this case), which reflect the informal atmosphere of the compiler classes.


Coming back to a bit of acads, we had a serious discussion on why SLR is

LR(0), in which the great minds of the class had to scratch their heads.





Now we are getting bogged down by algorithms...algos to construct items, algos for their closures, for making tables....and the list goes on. Still ppl are attending classes, which is quite surprising, when compared to the attendance in the Operating Systems class. Well hats off to our Prof for this one ;)




The exam fever is finally cropping up, with ppl asking each other about what is the syllabus and how much has sir taught, whether he will be able to finish the syllabus or not. Ppl have finally started opening the compiler text book for the first time and realised the fact that they shouldn't have slept in the classes.




Nothing much to write for today. The whole atmosphere is tense; midsems tomorrow, some ppl have 2 exams too. Still ppl have attended the class today and finally the syllabus was successfully completed.



Prepared by-


Muneish Kumar Adya

Pankaj Jajoo

Shravya Reddy K.

Hema Swetha K.

Tathagata Das