-1
$\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$ Commented Feb 15, 2016 at 15:20
  • 1
    $\begingroup$ Did you see (en.wikipedia.org/wiki/Left_recursion) article in wiki? $\endgroup$ Commented Feb 15, 2016 at 15:24

3 Answers 3

0
$\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$ Commented Jun 16, 2017 at 10:33
-1
$\begingroup$

enter image description hereenter image description here

This is correct. There is an epsilon production.

$\endgroup$
1
  • 5
    $\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.
    Commented Apr 26, 2020 at 20:45
-1
$\begingroup$

Left factoring S->SS+|SS*|a Using A->alpha A' A'->beta1|beta2|....beta n Solution: S->SSS'|a S'->+|*

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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