From cf59bbeb4d738688837f858c5ddc6c152ecc6dbe Mon Sep 17 00:00:00 2001 From: Teddy Date: Sat, 5 Apr 2014 16:00:49 +0800 Subject: ... --- ast.c | 8 ++++---- ast.h | 2 +- main.c | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ast.c b/ast.c index 239cab6..e73fdb8 100644 --- a/ast.c +++ b/ast.c @@ -367,13 +367,13 @@ char *cnode_debug_type_repr(CNode *ast) { assert(type); } if (aptr == abuff) - sprintf(buffer, "%s(%d:%d)", type, - ast->loc.row, ast->loc.col); + sprintf(buffer, "%s(%d:%d)->(var:%lx, type:%lx)", type, + ast->loc.row, ast->loc.col, (size_t)ast->ext.var, (size_t)ast->ext.type); else { *aptr = '\0'; - sprintf(buffer, "%s:%s(%d:%d)", type, abuff, - ast->loc.row, ast->loc.col); + sprintf(buffer, "%s:%s(%d:%d)->(var:%lx, type:%lx)", type, abuff, + ast->loc.row, ast->loc.col, (size_t)ast->ext.var, (size_t)ast->ext.type); } return buffer; } diff --git a/ast.h b/ast.h index 3ae318d..5176cca 100644 --- a/ast.h +++ b/ast.h @@ -45,7 +45,7 @@ typedef struct CNode { int subtype; char *strval; } rec; - union { + struct { CType *type; CVar *var; } ext; diff --git a/main.c b/main.c index 421f30d..2e7417b 100644 --- a/main.c +++ b/main.c @@ -46,6 +46,7 @@ void print_ast() { void print_sem() { yyparse(); semantics_check(ast_root); + cnode_debug_print(ast_root, 1); } void print_help() { -- cgit v1.2.3-70-g09d2