aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-10-06 15:39:16 -0400
committerTucker Evans <tuckerevans24@gmail.com>2019-10-06 15:39:51 -0400
commitaf85ccd5cda88601226323fbe7e922962ccf1ad0 (patch)
tree0c030f0c6858a9052d46c4d7153f56cfd0886950
parenta0ae72558a301f4a0082739712d30919f5e1454e (diff)
Add label in parse tree for code generation
-rw-r--r--tree.c3
-rw-r--r--tree.h2
2 files changed, 4 insertions, 1 deletions
diff --git a/tree.c b/tree.c
index e9d84e7..dabbb39 100644
--- a/tree.c
+++ b/tree.c
@@ -23,6 +23,7 @@ ptree *l, *r;
t->r = r;
t->ret_type = 0;
t->attr.nval = 0;
+ t->label = -1;
return t;
}
@@ -237,7 +238,7 @@ int spaces;
fprintf(stderr, "[?: %d]", t->type);
yyerror("Error in tree_print");
}
- fprintf(stderr," %d\n", t->ret_type);
+ fprintf(stderr," %d: L %d\n", t->ret_type, t->label);
aux_tree_print(t->l, spaces + 2);
aux_tree_print(t->r, spaces + 2);
}
diff --git a/tree.h b/tree.h
index b0a1085..cd8a947 100644
--- a/tree.h
+++ b/tree.h
@@ -16,6 +16,8 @@ typedef struct parse_tree {
} attr;
int ret_type;
struct parse_tree *l, *r;
+
+ int label;
} ptree;
void aux_tree_print(ptree*, int);