Added and changed code.

Added basic semantic analysis and finally made the code generator
generate valid code.