Merged all work together.

Rearrenged some incorrect parts in the generate_code function.
Tried to implement the generate_lhs_code: need to be finished and
tested.
ʕʘ̅͜ʘ̅ʔ