While removing null production from cfg as below,


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:


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...


to remove null from the method was


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.


Thankyou in Advance

  • $\begingroup$ Well, what is stopping you from removing the null production of $S$ ? $\endgroup$
    – Rinkesh P
    Commented May 14, 2023 at 14:28
  • $\begingroup$ We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. We prefer questions about a specific conceptual issue you're uncertain about. As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. $\endgroup$
    – D.W.
    Commented May 15, 2023 at 6:57
  • $\begingroup$ @RinkeshP I don't know how to do that.... If I introduce another grammar production rule like T->^ (let's take only null production from the above grammar) 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$
    – Zoha Javed
    Commented May 15, 2023 at 15:39
  • $\begingroup$ @D.W. oh Thankyou for guiding me correctly, I realized I didn't ask clearly what I wanted to know about . I'm going to edit it correct way! Thanks once again $\endgroup$
    – Zoha Javed
    Commented May 15, 2023 at 15:47


Your Answer

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