First and Follow Problems
First and Follow Problems
First and Follow sets are needed so that the parser can properly apply the needed production rule at
the correct position.
First Function-
Follow Function-
Find out first and follow from the following grammars and construct the
LL(1) from them.
Problem-01:
Calculate the first and follow functions for the given grammar-
S → aBDh
B → cC
C → bC / ∈
D → EF
E → g / ∈
F → f / ∈
Problem-02:
Calculate the first and follow functions for the given grammar-
S → (L) / a
L → SL’
L’ → ,SL’ / ∈
Problem-03:
Calculate the first and follow functions for the given grammar-
S → AaAb / BbBa
A→∈
B→∈