edited by
15,122 views
45 votes
45 votes

Consider the following grammar G

$S  \rightarrow F \mid H$

$F \rightarrow p \mid c$

$H \rightarrow d \mid c$ 

Where $S$, $F$, and $H$ are non-terminal symbols, $p, d$, and $c$ are terminal symbols. Which of the following statement(s) is/are correct?

S1: LL(1) can parse all strings that are generated using grammar G

S2: LR(1) can parse all strings that are generated using grammar G

  1. Only S1
  2. Only S2
  3. Both S1 and S2
  4. Neither S1 and S2
edited by

5 Answers

0 votes
0 votes
For deriving a terminal c ,we have S-> F->c and S->H->c . There are two parse trees for same terminal c.Hence the grammar is ambiguous and can't be LL1 or LR1
Answer:

Related questions

29 votes
29 votes
2 answers
1