0
$\begingroup$

I have a grammar
S-> SS* | SS+ | a
Really confused on how to remove the left recursion and do left factoring

My attempt on removing left recursion : S -> aS' S' -> S+S' | S*S' | epsilon
If this is correct, I'm stuck in left factoring. Help!

$\endgroup$
2
  • 2
    $\begingroup$ Are * and + terminals or operators? We use operators for shorthand, but they are not part of standard CFG notation. $\endgroup$ – Shreesh Feb 15 '16 at 15:20
  • 1
    $\begingroup$ Did you see (en.wikipedia.org/wiki/Left_recursion) article in wiki? $\endgroup$ – Shreesh Feb 15 '16 at 15:24
1
$\begingroup$

enter image description here

check this image the problem is explained

$\endgroup$
1
  • 3
    $\begingroup$ Please don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired, which we think is harmful. Please transcribe text and mathematics (note that you can use LaTeX). $\endgroup$ – David Richerby Jun 16 '17 at 10:33
0
$\begingroup$

enter image description hereenter image description here

This is correct. There is an epsilon production.

$\endgroup$
1
  • 3
    $\begingroup$ Please don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired, which we think is harmful. Please transcribe text and mathematics. Note that you can use LaTeX. $\endgroup$ – D.W. Apr 26 '20 at 20:45

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.