retagged by
413 views

2 Answers

Best answer
1 votes
1 votes

As options are about transition  $S \rightarrow a$ only I have designed diagram for that only and

new transition takes place then we'll check due to which Variable it is occurring and take its new lookahead.

At state I0, we start with augmented state so its look-ahead is $. In next transition in I0, marked S have lookahead as its follow which is S. So first of its immediately next S (.SS+) which is 'a' is lookahead .

Similarly in state I1, marked S will produce new transition with its lookahead as its follow i.e +.

In LALR(1) we combine states with same transition and different lookahead so I2 and I3 are combined. So we get option D.

selected by
0 votes
0 votes

The initial production (Augmented) contains '$' as it's look ahead. i.e.

S' -> . S, $

Now, this lookahead is carried out to every production, since all are derivation of 'S' and hence,

S->a is being one of that, has \$ as it's one of the lookahead. Rather in this question, as there's only 'S', all has '$' in their lookaheads. 

And since, opt B don't have $, it won't be correct answer.

Related questions

1 votes
1 votes
1 answer
1
Na462 asked Jan 26, 2019
1,408 views
1 votes
1 votes
1 answer
2
Na462 asked Jan 26, 2019
399 views
1 votes
1 votes
0 answers
3
Na462 asked Jan 21, 2019
1,036 views
Consider the following CFG.S → aSa|bSb|a|bNumber of conflicts in LR(0) State Diagram?28104
0 votes
0 votes
1 answer
4