4,645 views
1 votes
1 votes
I am confused in following kinds of Grammar they are;-

1) S - > AB

    A -> Ba

    B -> Bb

    B - > c

2) S - > AB

    A -> Ba

    B -> Bb

    B - > Epsilon

3) S - > AB

    A -> Ba

    B -> Bb

    B - > dollar

what will be the I0 state of these three grammars.

In 1st what will be the look ahead of B -> Bb and B - > c are we need to consider a or a/b.

In 2n what will be the look ahead of B -> Bb and B - > c are we need to consider a or a/epsilon.

In 3rd what will be the look ahead of B -> Bb and B - > c can we consider $ as look ahead symbol.

2 Answers

0 votes
0 votes

The last Case is not required for understanding and you should not write $ in the production. It represents the start of the stack.

 

For Concept:

@Shubhanshu In short, look-ahead of a non-terminal is the same for its every production.

Watch this video: Timestamp 5:38

https://www.youtube.com/watch?v=1XD2wk52-Cs&list=PLEbnTDJUr_IcPtUXFy2b1sGRPsLFMghhS&index=16

Related questions

1 votes
1 votes
1 answer
3
Rajesh R asked Dec 3, 2017
1,268 views
A - AA+A - aI think it's both clr and lalr . Can someone draw the diagram and answer it please because I want to verify the lookaheads of some states.
2 votes
2 votes
1 answer
4
sripo asked Nov 10, 2018
3,248 views
Can you give an example which is not LL(1) but is CLR(1)