1,659 views
3 votes
3 votes
lets consider a grammar as:

$A\rightarrow Ab | Ac | a$

while checking whether it belongs to LL(1) grammar, we would point out that it has a left recursion as well as left factoring.

I was wondering that what would be the case if we had lookahead, k,  greater than 1.

So if look ahead , k =2.

will there be any need to remove left recursion or left factoring. Furthermore, should we still call it as a:

1) left recursion: because if we are looking 2 symbols at a time, there shouldnt be any recursion at all.

2) left factoring: we need not backtrack as we are looking beyond the common symbol, A to decide the production rule to be applied.

any further insights about the same will be very helpful.

1 Answer

0 votes
0 votes
if a grammar has to be ll 1 then it should not be left recursive so you should eliminate left recursion while you need to make a grammar ll 1. If there is more than one production for the same variable as well as left recursion then there may be possibility to come all this production in the same cell of ll 1 parsing table because the left recursive variable we'll have same first and will keep those production in the first of left recursive variable  in ll 1 passing table.

Related questions

2 votes
2 votes
1 answer
1
sripo asked Nov 10, 2018
3,261 views
Can you give an example which is not LL(1) but is CLR(1)
0 votes
0 votes
1 answer
2
Rahul Ranjan 1 asked Mar 19, 2018
4,969 views
Given a grammar :$E \rightarrow E + T / T$$T \rightarrow i$Can I directly say that grammar is not $LL(1)$ because $LL(1)$ can't parse Left Recursive Grammar, without dra...
4 votes
4 votes
1 answer
3
8 votes
8 votes
3 answers
4
Parshu gate asked Nov 13, 2017
15,507 views
Suppose we are given a grammar and asked to find the type of that grammar , what is the algorithm which needs to be followed for each of them? LL(1), OR LR(0) , OR CLR(1...