Description:
In this video, I will explore some conditions that must be satisfied by grammars in order to apply Parsing Algorithms. The lesson is divided on the following sections:
0:00 (Section 1)
0:20 (Section 2)
0:41 (Section 3): the definition of Ambiguous Grammars
1:14 (Section 4): example of Ambiguous Grammar and two leftmost derivations for the same token stream, that is
num + num * num.
1:53 (Section 5): example of Unambiguous Grammar
2:34 (Section 6): LL(1) Grammars and an example that is not LL(1)
3:31 (Section 7): an example of LL(1) grammar and an example of deriving token stream
num + num * num
only seeing the current token. Firstly, the current token is the first "num", and a possible derivation is
EXPR
then T EXPR2
then F T2 EXPR2
then G F2 T2 EXPR2
then H G2 F2 T2 EXPR2
and at last "num" G2 F2 T2 EXPR2.
As we already derived "num", the next token is "+". So, the derivation for it is
"num" G2 F2 T2 EXPR2
then num lambda F2 T2 EXPR2
then num F2 T2 EXPR2
then num lambda T2 EXPR2
then num T2 EXPR2
then num lambda EXPR2
then num EXPR2
and at last num + T EXPR2.
For the second token "num", the derivation can be seen from T EXPR2 and following a similar process to that on the first token "num", as also for the third token "num". For token "*", the process looks like that of token "+".
4:33 (Section 8): Conclusion
Share this link via
Or copy link























