def process_lasgn(exp)
out = ""
var = exp.shift
value = exp.shift
arg_count = 0
arg_count = value.length - 1 if value.first == :array
args = value
exp_type = exp.sexp_type
@env.add var.to_sym, exp_type
var_type = self.class.c_type exp_type
if exp_type.list? then
assert_type args, :array
raise "array must be of one type" unless args.sexp_type == Type.homo
array_type = args.sexp_types.empty? ? 'void *' : self.class.c_type(args.sexp_types.first)
args.shift
out << "#{var} = (#{array_type}) malloc(sizeof(#{array_type}) * #{args.length});\n"
args.each_with_index do |o,i|
out << "#{var}[#{i}] = #{process o};\n"
end
else
out << "#{var} = #{process args}"
end
out.sub!(/;\n\Z/, '')
return out
end