How to convert improper CFG to weakly equivalent one? In wikipedia there's the definition for "Proper CFG".


  A context-free grammar is said to be proper, if it has
  
  $$\text{no unreachable symbols}: \forall N \in V: \exists \alpha,\beta
&gt; \in (V\cup\Sigma)^*: S \stackrel{*}{\Rightarrow} \alpha{N}\beta$$
  $$\text{no unproductive symbols}: \forall N \in V: \exists w \in
&gt; \Sigma^*: N \stackrel{*}{\Rightarrow} w$$ $$\text{no ε-productions}:
&gt; \neg\exists N \in V: (N, \varepsilon) \in R$$ $$\text{no cycles}:
&gt; \neg\exists N \in V: N \stackrel{+}{\Rightarrow} N$$


https://en.wikipedia.org/wiki/Context-free_grammar#Proper_CFGs

It's also stated that non-proper CFGs can be transformed into "weakly equivalent" CFGs:


  In formal language theory, weak equivalence of two grammars means they generate the same set of strings, i.e. that the formal language they generate is the same.


https://en.wikipedia.org/wiki/Equivalence_(formal_languages)

but I cannot find the algorithm for doing this.

How is it done?
First of all, Wikipedia does supply a reference to a standard textbook. Second, since a proper grammar is one without unproductive symbols, to make a grammar proper all you have to do is erase all unproductive symbols and all productions involving them.