While removing null production from cfg as below,
S->ABC
A->aA|^
B->bB|^
C->aaC|^
now as shown above we know that A,B and C all are nullable that makes S also nullable. like I'd do as below:
S->ABC|AB|AC|BC|A|B|C|^
A->aA|a
B->bB|b
C->aaC|aa
The question is how do I remove null from S? I tried searching but I everything getting mixed up....
Like one solution was defining new rule. I can't find the link now but it told to do something like below We have only one null production left...
S->^
to remove null from the method was
S->T
T->^
but the problem is S now become nullable production and there in still null production in the grammar i-e T->^
Another solution was to make new rule (as below) such that at least starting symbol is not null production but from my understanding its still nullable... There still exists a null in the grammar.
S1->S
S->^
Thankyou in Advance
S->T T->^
This is still nullable production... Is there any other method I don't know of ? I'd like to know more about how am I to remove null production completely Thankyou! $\endgroup$