Fixed compiler warnings and turned on -Werror
Reworked codegenerator to generate to file or standard output