# Left recursion for LL(1) [closed]

Hi I am trying to solve a LL(1) form question for first n follow rule The question is

A::=BC|C
B::=Bd|ef
C::=gh|j


What I have done to eliminate left recursion

A::=CA’
A’::=CB’
A’::=ϵ
B::=efB’
B::=dB’
B’::=ϵ
C::=gh
C::= j


Is it correct?

Thanks guys, it has been solved.

## closed as unclear what you're asking by D.W.♦, FrankW, vonbrand, Juho, Artem KaznatcheevMar 27 '14 at 7:54

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• This question appears to be unsuited for this site because questions of the form: "This is the exercise problem, this is my solution. Please grade!" are not interesting for anyone but you. Please see this related meta discussion. If you want to ask a specific question about a specific part of your attempt, please edit the question accordingly and it may be reopened. Otherwise, you might want to visit Computer Science Chat and get some feedback there. – Raphael Mar 27 '14 at 8:38

The only left-recursive rule is the one for $B$. The nonterminal $A$ produces no problems, $\operatorname{first}(B) = \{ e \}$ while $\operatorname{first}(C) = \{ g, j \}$. So you need to eliminate left recursion for $B$:
• $\operatorname{first}(A) = \operatorname{first}(BC) \cup \operatorname{first}(C) = \operatorname{first}(B) \cup \operatorname{first}(C) = \{d, e, g, h \}$ – vonbrand Mar 13 '14 at 19:23