logo
down
shadow

confusion in finding first and follow in left recursive grammar


confusion in finding first and follow in left recursive grammar

By : benmcrae
Date : November 18 2020, 11:13 AM
wish of those help Recently I faced the problem for finding first and follow , Firstly,you'll need to remove left-recursion leading to
code :
S -> cAd
A -> aA'
A' -> bA' | epsilon
FIRST(A) = a         // as a is the only terminal nderived first from A.
S -> AS'
S' -> AS' | epsilon
A -> a

FIRST(A) = a
FIRST(S) = a
FIRST(S') = {a,epsilon}.


Share : facebook icon twitter icon
Left-factoring a non-left-recursive grammar to make it LL(1)

Left-factoring a non-left-recursive grammar to make it LL(1)


By : PatPawlowski
Date : March 29 2020, 07:55 AM
Hope that helps No, this grammar is not LL(1). At least, the last rules group is not left factored, since FIRST( Expr) and FIRST( Expr, Arglist) do interstect.
How to find FIRST and FOLLOW sets of a recursive grammar?

How to find FIRST and FOLLOW sets of a recursive grammar?


By : user3364917
Date : March 29 2020, 07:55 AM
Any of those help Since FIRST and FOLLOW are (normally) recursive, it's useful to think of them as systems of equations to be solved; the solution can be achieved using a simple incremental algorithm consisting of repeatedly applying all the right hand sides until no set has changed during a cycle.
So let's take the FOLLOW relation for the given grammar:
code :
A → B | Cx | ε
B → C | yA
C → B | w | z
FOLLOW(A) = FOLLOW(B) ∪ {$}
FOLLOW(B) = FOLLOW(A) ∪ FOLLOW(C)
FOLLOW(C) = FOLLOW(B) ∪ {x}
FOLLOW(A) = {} ∪ {$} = {$}
FOLLOW(B) = {$} ∪ {} = {$}
FOLLOW(C) = {$} U {x} = {$,x}
FOLLOW(A) = {$} ∪ {$} = {$}
FOLLOW(B) = {$} ∪ {$,x} = {$,x}
FOLLOW(C) = {$,x} U {x} = {$,x}
FOLLOW(A) = {$,x} ∪ {$} = {$,x}
FOLLOW(B) = {$} ∪ {$,x} = {$,x}
FOLLOW(C) = {$,x} U {x} = {$,x}
FOLLOW(A) = {$,x} ∪ {$} = {$,x}
FOLLOW(B) = {$,x} ∪ {$,x} = {$,x}
FOLLOW(C) = {$,x} U {x} = {$,x}
Finding first and follow in a grammar

Finding first and follow in a grammar


By : Ezequiel Netto
Date : March 29 2020, 07:55 AM
I hope this helps you . Your computation of the follow sets of L and L' is correct, so the answer you cite is either incorrect or applies to some other grammar.
How to find FIRST and FOLLOW set of a recursive grammar?

How to find FIRST and FOLLOW set of a recursive grammar?


By : Lily5912
Date : March 29 2020, 07:55 AM
it should still fix some issue Your work above (question) suggest that you are not good in basic concepts. So you can make use of the this tutorial.
Grammer :
Confusion in finding follow of Gammar

Confusion in finding follow of Gammar


By : Summergirl012
Date : March 29 2020, 07:55 AM
will help you I have confusion in finding follow of Grammar , Both are incorrect.
code :
FOLLOW(A) of non-terminal A is the set of terminal symbols 
that can follow in the derivation sequence
             S->(L)  
            L->L,S
           FOLLOW(L) = {),,}
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org