Fixed some bugs in code gen
Fixed bugs about the code gen and write a script to do the compiler(generator code) job