I had my language processors lab today. Although I hadn't studied much I was confident that I would do okay. I reached there at 9:10 am (courtesy Sourav), and came to know that the exam was supposed to begin at 9:00 am . Fortunately the exam only began at 9:30. I got a question to implement a symbol table for C in C. It wasn't too tough and I was able to do it. The other guys in my batch had to implement FIRST and FOLLOW. Initially I thought that they had to implement it for any grammar, which seemed quite unreasonable, but they had to do it for a given grammar.
The algorithm for any generic grammar is a bit tough to implement and not easy to understand. The cases which we have to take care are the following.
- When there is left recursion.
- When there are cycles in the grammar
A->B
B->C
C->A
- When there are epsilon productions.
No comments:
Post a Comment