edited by
3,282 views

3 Answers

1 votes
1 votes
(after removing left recursion)

S->S’

S’->S+S’/S*S’/a/∈

 

FIRST(S)={a,∈}

FIRST(S’)={a,∈}

FOLLOW(S)={ +,*}

FOLLOW(S’)={ +,* }
1 votes
1 votes

Given grammar :

$S\rightarrow SS+/ SS*/ a$

after removing left recursion :

$S \rightarrow aS$’

$S’\rightarrow S+S’/S*S/\epsilon$
 

  First()              follow()
$S$ (a) $(\$,+,*)$
$S’$ $(a,\epsilon)$ $(\$,+,*)$

 

edited by

Related questions

0 votes
0 votes
1 answer
1
Sara Wageh asked Dec 31, 2021
1,061 views
S- SS | AaA->Sb | a(a) prove that the grammar is ambiguous.(b) find the follow for the grammar(c) then remove the left recursion from the grammar.
4 votes
4 votes
1 answer
2
2 votes
2 votes
1 answer
3
1 votes
1 votes
2 answers
4
Anand. asked Jan 7, 2017
2,394 views
Eliminate the left recursion of the grammar:$S\rightarrow Bb / a$$B\rightarrow Bc /Sd /e$