0 votes 0 votes Grammar : E->T+E/T T->id/id*T/(E) Is grammar LL(2)? Compiler Design context-free-grammar + – saxena0612 asked Sep 26, 2017 saxena0612 437 views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply saxena0612 commented Sep 26, 2017 reply Follow Share This grammar has left factoring problem but only when look ahead is limilted to 1 but does it continue when look ahead is 2? Please give a proper explanation! 0 votes 0 votes Hira Thakur commented Sep 26, 2017 reply Follow Share how LL(2) differs from LL(1)??? 0 votes 0 votes Please log in or register to add a comment.
Best answer 1 votes 1 votes Yes this grammar is not LL(1) but it's LL(2). T->id | id*T this grammar is not LL(1) because if we show one look ahead to parser, it can not decide which production to choose, but if the length of look ahead is 2, there is no problem. Manu Thakur answered Sep 26, 2017 selected Sep 26, 2017 by saxena0612 Manu Thakur comment Share Follow See all 2 Comments See all 2 2 Comments reply saxena0612 commented Sep 26, 2017 reply Follow Share So does that imply that ll(k+1) parsers are more powerful than ll(k) parsers? 0 votes 0 votes Manu Thakur commented Sep 26, 2017 reply Follow Share yes!! Only note one thing that, if a grammar is ambiguous then for no value of k (k>0) LL(k) parser can parse it. 0 votes 0 votes Please log in or register to add a comment.