Corrected a loop related issues in enterProgram and enterTopExpressions
in new compilation logic.
Corrected a few issues with generation of assignment and variable
declarations in new compilation logic.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>