aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeddy <ted.sybil@gmail.com>2014-04-05 16:00:49 +0800
committerTeddy <ted.sybil@gmail.com>2014-04-05 16:00:49 +0800
commitcf59bbeb4d738688837f858c5ddc6c152ecc6dbe (patch)
tree09cd700ab81a0545d5c9c41791ab3639e4fbf60d
parentd30f1626370880275c0e046e31c2d9942ab2fd3a (diff)
...
-rw-r--r--ast.c8
-rw-r--r--ast.h2
-rw-r--r--main.c1
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() {