code generation almost working for simple cases. need to add memory allocation