static void pr_dec(FILE *out, A_dec v, int d) { indent(out, d); switch (v->kind) { case A_functionDec: fprintf(out, "functionDec(\n"); pr_fundecList(out, v->u.function, d+1); fprintf(out, ")"); break; case A_varDec: fprintf(out, "varDec(%s,\n", S_name(v->u.var.var)); if (v->u.var.typ) { indent(out, d+1); fprintf(out, "%s,\n", S_name(v->u.var.typ)); } pr_exp(out, v->u.var.init, 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"); pr_nametyList(out, v->u.type, d+1); fprintf(out, ")"); break; default: assert(0); } }
static void pr_fundecList(FILE *out, A_fundecList v, int d) { indent(out, d); if (v) { fprintf(out, "fundecList(\n"); pr_fundec(out, v->head, d+1); fprintf(out, ",\n"); pr_fundecList(out, v->tail, d+1); fprintf(out, ")"); } else fprintf(out, "fundecList()"); }