static void pr_dec(FILE *out, A_dec v, int d) { indent(out, d); switch (v->kind) { case A_functionDec: fprintf(out, "functionDec(%s,\n", S_name(v->u.function.func)); pr_tyfieldList(out, v->u.function.tyfieldList, d + 1);fprintf(out, ",\n"); fprintf(out, "%s,\n", S_name(v->u.function.type)); pr_exp(out, v->u.function.exp, d + 1); fprintf(out, ")"); break; case A_varDec: fprintf(out, "varDec(%s,\n", S_name(v->u.var.id)); if (v->u.var.type) { indent(out, d + 1); fprintf(out, "%s,\n", S_name(v->u.var.type)); } pr_exp(out, v->u.var.exp, d + 1); fprintf(out, ",\n"); indent(out, d + 1); //fprintf(out, "%s", v->u.var.escape ? "TRUE)" : "FALSE)"); break; case A_typeDec: fprintf(out, "typeDec(\n"); fprintf(out, "%s,\n", S_name(v->u.type.type)); pr_ty(out, v->u.type.ty, d + 1); fprintf(out, ")"); break; default: assert(0); } }
static void pr_namety(FILE *out, A_namety v, int d) { indent(out, d); fprintf(out, "namety(%s,\n", S_name(v->name)); pr_ty(out, v->ty, d+1); fprintf(out, ")"); }