diff options
-rw-r--r-- | main.c | 6 | ||||
-rw-r--r-- | node.c | 2 | ||||
-rw-r--r-- | pc.y | 2 | ||||
-rw-r--r-- | tree.c | 7 |
4 files changed, 13 insertions, 4 deletions
@@ -17,10 +17,10 @@ int t; { if (t == ARRAY) { return "ARRAY"; - } else if (t == INT - ARRAY) { - return "ARRAY of INT"; - } else if (t == INT - ARRAY) { + } else if (t == ARRAY - INT) { return "ARRAY of INT"; + } else if (t == ARRAY - REAL) { + return "ARRAY of REAL"; } else if (t == INT) { return "INT"; } else if (t == REAL) { @@ -15,6 +15,8 @@ char *str; p->name = strdup(str); p->next = NULL; + p->var_type = -1; + return p; } @@ -192,10 +192,12 @@ param_list :id_list ':' type { $$ = $1; + update_type_info($1, $3); } |param_list ';' id_list ':' type { $$ = mktree(LIST, $1, $3); + update_type_info($3, $5); } ; @@ -61,10 +61,15 @@ int type; ptree *list; { assert(list); + if (list->type == ID) { + list->attr.nval->var_type = type; + return; + } + while (list->r && list->r->type == ID) { /*Set type of right child through list*/ list->r->attr.nval->var_type = type; - + if (list->l) { if (list->l->type == LIST) { list = list->l; |