Sine to Square wave converted using only transistors
Using the simulation schematic:

Q1 and Q2 form a switchable constant current source.


With U1 off R1 pulls Q2's base high turning Q2 off. No current flows to the output.
With U1 on current is drawn from Q2's base turning it on and feeding current to the output.
As the output current increases a voltage drop occurs on R2. When this reaches about 0.7 V (at 70 mA) Q1 will start to turn on and steal the bias current from Q2 preventing the Q2 current from rising any further.


As a result the output will switch from 0 mA to 70 mA maximum (if the load resistance is less than about 150 &Omega;).


  ... its clear that it takes Sine wave and the output is amplified square wave with the same frequency.


The only bit remaining is understanding the operation of U1. From the Electrical Characteristics and Figure 1 of the 2N7002 datasheet we can see that the device will turn on with about 2.1 to 3 V applied to the gate. This will cause the drain-source resistance to drop to only a few ohms (see Figure 2). Thus U1 acts much like a relay would but controlled by the AC voltage applied.