edited by
1,332 views
1 votes
1 votes

 

edited by

1 Answer

0 votes
0 votes

As, None of the option says "Grammar is not SLR(1)", I am directly trying to parse the string here.

Try to derive the string from the given productions, by following Right most derivation.(Cause we are dealing with bottom-up parsers,this is useful at the end)

S->AB (B is bolded to indicate that it is expanding in the next step)

  ->Ac (you can see, we are producing 'B' first, as we are following Right most derivation)

  ->aAc

  ->aaAc

  ->aabBc

  ->aabbBc

  ->aabbcc

Now, start looking, bottom up, just like how, bottom up parsers do: Right most derivation in reverse.

We can observe the order : B,B,A,A,A,B,S.

So,  C is correct choice.

 

Related questions

1 votes
1 votes
1 answer
1
Na462 asked Jan 26, 2019
376 views
1 votes
1 votes
0 answers
2
Na462 asked Jan 21, 2019
994 views
Consider the following CFG.S → aSa|bSb|a|bNumber of conflicts in LR(0) State Diagram?28104
0 votes
0 votes
1 answer
3
0 votes
0 votes
2 answers
4
garg div asked Nov 19, 2017
385 views
PLEASE anyone can explain the states step wise Ans is given D