+ struct psi_plist *output, *input;
+ struct element {
+ token_t type;
+ union {
+ impl_val value;
+ psi_calc calc;
+ struct psi_decl_type *cast;
+ } data;
+ } entry, lhs, rhs;
+
+ output = psi_plist_init_ex(sizeof(entry), NULL);
+ input = psi_plist_init_ex(sizeof(entry), NULL);
+
+ psi_num_exp_reduce(exp, &output, &input, frame, defs);
+
+ while (psi_plist_pop(input, &entry)) {
+ if (frame) PSI_DEBUG_PRINT(frame->context, " %s", psi_num_exp_op_tok(entry.type));
+ output = psi_plist_add(output, &entry);
+ }
+ if (frame) PSI_DEBUG_PRINT(frame->context, "%s", "\n");
+
+ while (psi_plist_shift(output, &entry)) {
+ switch (entry.type) {
+ default:
+ input = psi_plist_add(input, &entry);
+ break;
+
+ case PSI_T_CAST:
+ psi_plist_pop(input, &rhs);
+ if (frame) PSI_DEBUG_PRINT(frame->context, " %s", psi_num_exp_op_tok(entry.type));
+ psi_impl_val_dump(rhs.type, &rhs.data.value, frame);
+
+ entry.type = psi_decl_type_get_real(entry.data.cast)->type;
+ psi_calc_cast(rhs.type, &rhs.data.value, entry.type, &entry.data.value);
+ input = psi_plist_add(input, &entry);
+ psi_num_exp_verify_result(entry.type, &entry.data.value, frame);
+ break;