edited by
170 views
0 votes
0 votes

A grammar symbol $X$ (terminal or nonterminal) is useless if there is no derivation of the form $S \overset{\ast}{\Rightarrow}​​​​​wXy\overset{\ast}{\Rightarrow} wxy$. That is, $X$ can never appear in the derivation of any sentence.

  1. Give an algorithm to eliminate from a grammar all productions containing useless symbols.
  2. Apply your algorithm to the grammar:
  • $S\rightarrow 0\mid A$
  • $A\rightarrow AB$
  • $B\rightarrow 1$
edited by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
0 answers
1
admin asked Aug 17, 2019
418 views
The grammar in Fig. $4.7$ generates declarations for a single numerical identifier; these declarations involve four different, independent properties of numbers.Generaliz...
0 votes
0 votes
0 answers
2
admin asked Aug 17, 2019
207 views
Extend the idea of Question $4.2.4$ to allow any regular expression of grammar symbols in the body of a production. Show that this extension does not allow grammars to de...