diff --git a/src/common.h b/src/common.h index bb599e9..da382e3 100644 --- a/src/common.h +++ b/src/common.h @@ -27,7 +27,7 @@ // #define TEST_STACK // #define DEBUG_STACK // #define DEBUG_STEP -// #define DEBUG_STRESS_GC +#define DEBUG_STRESS_GC // #define DEBUG_LOG_GC // #define DEBUG_GC // #define DEBUG_TPMC_MATCH diff --git a/src/debug.c b/src/debug.c index 948807b..077ee48 100644 --- a/src/debug.c +++ b/src/debug.c @@ -496,6 +496,26 @@ void printCexpIf(CexpIf *x) { fprintf(stderr, ")"); } +void printCexpCond(CexpCond *x) { + fprintf(stderr, "(cond "); + printAexp(x->condition); + fprintf(stderr, " "); + printCexpCondCases(x->cases); + fprintf(stderr, ")"); +} + +void printCexpCondCases(CexpCondCases *x) { + while (x != NULL) { + fprintf(stderr, "(%d ", x->option); + printExp(x->body); + fprintf(stderr, ")"); + if (x->next) { + fprintf(stderr, " "); + } + x = x->next; + } +} + void printCexpLetRec(CexpLetRec *x) { fprintf(stderr, "(letrec "); printLetRecBindings(x->bindings); @@ -625,6 +645,9 @@ void printCexp(Cexp *x) { case CEXP_TYPE_IF: printCexpIf(x->val.iff); break; + case CEXP_TYPE_COND: + printCexpCond(x->val.cond); + break; case CEXP_TYPE_CALLCC: fprintf(stderr, "(call/cc "); printAexp(x->val.callCC); diff --git a/src/debug.h b/src/debug.h index 1708743..4ebaa30 100644 --- a/src/debug.h +++ b/src/debug.h @@ -41,6 +41,8 @@ void printCexp(Cexp *x); void printCexpMatch(CexpMatch *x); void printMatchList(MatchList *x); void printCexpIf(CexpIf *x); +void printCexpCond(CexpCond *x); +void printCexpCondCases(CexpCondCases *x); void printCexpLetRec(CexpLetRec *x); void printCTEnv(CTEnv *x); void printExp(Exp *x);