SCRUMble ! Hello Blog Readers! Thank you for all your support and encouragement. I have something exciting for you all. I have recently written and published a new book called 'SCRUMble !'. It is currently available on pothi store. It will be soon available on Amazon and Flipkart as well. Please get your copy and do let me know your reviews. -Abhishek Sathe SCRUMble ! Written and Published by: Abhishek Sathe Distributed by: pothi.com Order your copy now: https://store.pothi.com/book/abhishek-sathe-scrumble/ Coming soon on Amazon and Flipkart About the book: Scrum is a framework for solving complex problems largely adapted by Software Development field. There are multiple ag...
Consider an example:
E -> TE'
E' -> +TE'
T -> +T
Compute First() for below grammer.
First(+) = {+} //Rule 1
First(E) = {+} //Rule 3
First(T) = {+} //Rule 2
First(E') = {+} //Rule 2
Rules to compute First()
Rule 1
If t is a terminal, then First(t)={t}
Rule 2
If N is a nonterminal and N -> aX , where a is a terminal then First(N) = {a}
Rule 3
If N is a nonterminal and N -> N1N2... , where, N1,N2,... are all nonterminals then First(N)=First(N1).
If First(N1) is an empty set then First(N)=First(N2) and so on.
If all are empty then First(N) is also an empty set.
From above rules it should be easy to compute First set for any grammer.
E -> TE'
E' -> +TE'
T -> +T
Compute First() for below grammer.
First(+) = {+} //Rule 1
First(E) = {+} //Rule 3
First(T) = {+} //Rule 2
First(E') = {+} //Rule 2
Rules to compute First()
Rule 1
If t is a terminal, then First(t)={t}
Rule 2
If N is a nonterminal and N -> aX , where a is a terminal then First(N) = {a}
Rule 3
If N is a nonterminal and N -> N1N2... , where, N1,N2,... are all nonterminals then First(N)=First(N1).
If First(N1) is an empty set then First(N)=First(N2) and so on.
If all are empty then First(N) is also an empty set.
From above rules it should be easy to compute First set for any grammer.
Comments
Post a Comment