let rec gen_bound_vars_of_string_sexpr ({ type_of_sexpr } as conv) b accum = function (* All bindings consumed: return accumulator in original order *) | [] -> List.rev accum (* Take first binding *) | HStringSExpr.List [HStringSExpr.Atom v; t] :: tl -> (* Get the type of the expression *) let var_type = type_of_sexpr t in (* Create a variable of the identifier and the type of the expression *) let tvar = Var.mk_free_var v var_type in (* Add bound expresssion to accumulator *) gen_bound_vars_of_string_sexpr conv b (tvar :: accum) tl (* Expression must be a pair *) | e :: _ -> failwith ("Invalid expression in let binding: " ^ (string_of_t HStringSExpr.pp_print_sexpr e))