1
$\begingroup$
S → D
D → E | EC
E → anyId
C → B | .D | B.D
B → <S> | <SA>
A → ,S | ,SA

The tool I am using keeps complaining about left recursion in this grammar. I can't see where.

The language recognized is something like:

anyId
anyId.anyId
anyId<anyId>
anyId<anyId>.anyId<anyId,anyId>
$\endgroup$
  • $\begingroup$ Did you specify the start symbol correctly? Try also to get rid of unit productions. $\endgroup$ – fade2black Jul 3 '17 at 14:56
  • $\begingroup$ What tool are you using? That grammar is not left-recursive afaics but it isn't LL(k) either. $\endgroup$ – rici Jul 3 '17 at 15:35
  • $\begingroup$ Thanks for the hint. In fact, this grammar looks the way it looks because I was trying to be "as much literally faithful as possible" to a non-LL(*) informal specification. I will follow your hint and just implement the requirements in a more "natural" way. $\endgroup$ – AmazingWouldBeGreatBut Jul 3 '17 at 15:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.