First version

Code generation partially implemented. Some bugs in generated code.