Add code generation for struct type
Update spec, fix compile error