edited by
1,413 views

2 Answers

9 9 votes

$\boxed{\text{Answer: C}}$

Watch detailed discussion on this question


  1. $\text{LL(1)}$ parser uses backtracking. $\ \textcolor{red}{\boxed{\text{False}}}$
No, $\text{LL(1)}$ parser is a predictive parser. When expanding a nonterminal, $\text{LL(1)}$ parser predict the production to use by looking at the next token of the input. The decision is forced. So, $\text{LL(1)}$ parser is not using backtracking.
  1. For a grammar to be $\text{LL(1)}$, it must be left-recursive. $\ \textcolor{red}{\boxed{\text{False}}}$
No. In fact for a grammar to be $\text{LL(1)}$, it must not be left-recursive. Since left-recursive grammar can never be $\text{LL(1)}$. Proof1 Proof2
  1. For a grammar to be $\text{LL(1)}$, it must be left-factored. $\ \textcolor{blue}{\boxed{\text{True}}}$
Yes, because non-left-factored grammar can never be $\text{LL(1)}$. Proof
  1. The $\text{LL(1)}$ parsers are more powerful than the SLR parsers. $\ \textcolor{red}{\boxed{\text{False}}}$
No, there are some grammars which $\text{SLR}$ parser can parse but can't be parsed by $\text{LL(1)}$ parser. That is, some $\text{SLR}$ grammar is not $\text{LL(1)}$.
Consider the following grammar which is $\text{SLR}$ but not $\text{LL(1)}:$
$$S \rightarrow S A \text { | } A$$
$$S \rightarrow a$$
Actually, there is no relationship between $\text{LL(1)}$ parsers and $\text{SLR}$ parsers. That is, neither $\text{LL(1)}$ parsers are more powerful than the $\text{SLR}$ parsers nor $\text{SLR}$ parsers are more powerful than the $\text{LL(1)}$ parsers.

Goodread:

Source: https://people.cs.vt.edu/prsardar/classes/cs3304-Spr19/lectures/CS3304-10-LanguageSyntax-3.pdf

Source: Modern Compiler Implementation in C by Andrew Appel

Source: Ullman (Dragon Book)

0 0 votes

ANS (C) 

LL(1) parsers are predictive parsers.

  • LL = Left to right scan, Leftmost derivation.
     
  • (1) = Uses 1 lookahead symbol.

 

Since the parser already knows which production to choose using the parsing table and one lookahead token, 

there is no need to backtrack.

 

Also, 

LL(1) must not have left recursion 

LL(1) is not more powerful than SR(1) or SLR

LL(1) must not have FIRST-FIRST conflict

LL(1) must not have FIRST-FOLLOW conflict

LL(1) must not be ambiguous

Answer:
Position:
Show:

Related questions

19 19 votes
2 2 answers
11.1k
11.1k views
Arjun asked Feb 16, 2024
11,117 views
Consider the following context-free grammar where the start symbol is $\text{S}$ and the set of terminals is $\{a, b, c, d\}$.$$\begin{array}{l}S \rightarrow A a A b \mid...
9 9 votes
4 4 answers
1.9k
1.9k views
gatecse asked Feb 23
1,851 views
Consider the following C statements:char *str1 = "Hello; /* Statement S1 */ char *str2 = "Hello;"; /* Statement S2 */ int *str3 = "Hello"; /* Statement S3 */Which of the ...
8 8 votes
2 2 answers
1.2k
1.2k views
gatecse asked Feb 23
1,220 views
​​​​​​Consider the following two syntax-directed definitions $\text{SDD1}$ and $\text{SDD2}$ for type declarations. SDD1Grammar (G1)Semantic Rules$D \rightarrow T\ V$$D.t...