diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-10-07 19:17:55 -0400 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-10-07 19:17:55 -0400 |
commit | f64eced412b2d779af7785b0409ca10889741118 (patch) | |
tree | 120d713b0285d45a7e108b2e7ac47b6e2415dc64 | |
parent | 279c9a29eedcbfd6748ac6e5e33fe4a26ed29188 (diff) |
Add generate statement code in correct order
-rw-r--r-- | gen_code.c | 16 | ||||
-rw-r--r-- | gen_code.h | 4 |
2 files changed, 14 insertions, 6 deletions
@@ -71,12 +71,24 @@ ptree *t; } } +gen_statement_order(t) +ptree *t; +{ + if (t->type != LIST){ + gen_statement(t); + return; + } + + gen_statement_order(t->l); + gen_statement_order(t->r); + +} + void gen_code(t, name) ptree *t; char *name; { printf("\n.globl %s\n.type %s, @function\n%s:\n", name, name, name); - /*TODO call gen_statement on all statements in LIST t*/ - /*Look at set_type for list traverseal code*/ + gen_statement_order(t); } @@ -3,8 +3,4 @@ #include "tree.h" void gen_code(ptree*, char*); - -void gen_expr(ptree*); -void gen_statement(ptree*); - #endif |