An LALR(1) parser for a grammar G can have
shift reduce S – R conflict if and only if the LR(1)
parser for G has S – R conflicts.
Theory of Computation and Compilers MCQ - Syntax Analysis
t is LL(1) and LR(1)
because in S → aSa
S → bS
S → c
no mult iple ent r ies for 1 iteration, so it is LL(1)
grammer mean by LR(1) that it is Left shift
Reduced grammer and so it is also LR(1).
Hence it is both LL(1) and LR(1)
no mult iple ent r ies for 1 iteration, so it is LL(1)
grammer mean by LR(1) that it is Left shift
Reduced grammer and so it is also LR(1).
Hence it is both LL(1) and LR(1)As per given question, a grammar with no epsilon and
unit -production (i.e., of type A → ε and A →
a).
So To Reduce input string of n tokens, first Reduce
n – 2 tokens using n – 2 reduce moves and then
Reduce last 2 tokens using production which has.
So total of n – 2 + 1 = n – 1 Reduce moves
(1) false, as merging has been done because lookahead
were different.
(2) false, Shift-Reduce conflict never occur at the
time of merging.
(3) false, In the merged set, we can’t see any
Reduce-Reduce conflict (no reduction even
possible, so no chances of R-R conflict )
(4) false, because goto is carried on Non-Terminals
symbols, not on terminal symbols, and c is a
terminal symbol.
Form above diagram, we can see that there is no
shift -reduce or reduce-reduce conflict .
