391 views
0 votes
0 votes
$S \rightarrow aBA$

$A \rightarrow \epsilon$

$B \rightarrow a$

Here in the given grammar, what will be the look ahead of B's production:-

$S \rightarrow a.BA , \$  $

$B \rightarrow .a  \text{ ,   X}$

What will come at the place of X, I think it should be "\$", As $ A \rightarrow \epsilon$, So, B's lookahead should be \$.

right?

1 Answer

Best answer
1 votes
1 votes

YES.

At the place of X, it should be { first of A or \$ } but first of A is $\epsilon$, yes, \$ will be there.

selected by

Related questions

0 votes
0 votes
1 answer
1
abc1 asked Jan 26, 2019
4,037 views
consider the grammar G: S->A|B A->a|c B->b|c where {S,A,B} are non-terminals,{a,b,c} are terminals.Does LR(1) can parse all strings that are generated by gr...
8 votes
8 votes
3 answers
2
Parshu gate asked Nov 13, 2017
15,458 views
Suppose we are given a grammar and asked to find the type of that grammar , what is the algorithm which needs to be followed for each of them? LL(1), OR LR(0) , OR CLR(1...
2 votes
2 votes
1 answer
3
Akriti sood asked Dec 10, 2016
4,254 views
can LR(1) parser parse any context-free grammar/language ??and hence every regular language can be parsed by LR(1) parsers.
9 votes
9 votes
3 answers
4
ShiveshRoy asked May 13, 2016
12,555 views
Whether LR(1) grammar is same as that of CLR(1) grammar. If yes then please explain and if not then what is the difference between them?