1
$\begingroup$

Kindly consider the following productions. How can I identify a useless production?

S->aS|A|C

A->a

B->aa

C->aCb

Somebody please guide me. Zulfi.

$\endgroup$

2 Answers 2

1
$\begingroup$

Starting from $S$ it is impossible to generate a sentential form that contains the nonterminal $B$.

This is easy to see since:

  • $S$ only has productions whose body contain $S$ itself, $A$ or $C$.

  • $A$ has no nonterminals in the body of its productions.

  • $C$ has only $C$ itself in the body of its productions.

This means that the production $B \to aa$ is useless.

$\endgroup$
1
$\begingroup$

Useless symbols are those that do not appear in any derivation from the start variable of some terminal string. If you similarly define useless productions to be those productions that are not used in any derivation from the start variable of a terminal string, then observe that the production $B \rightarrow aa$ is useless because $B$ is not reachable from the start variable, and the production $C \rightarrow aCb$ is also useless because it does not derive any terminal string - once we use this production, the nonterminal symbol $C$ will be contained in every further sentential form, and so we can't obtain a string containing only terminal symbols.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.