From 7e29eae526f7a5014934b92a239923dd30835afd Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Mon, 5 Aug 2019 21:31:48 -0400 Subject: WIP Add function and array info to node struct --- pc.y | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'pc.y') diff --git a/pc.y b/pc.y index 81cb69b..cd993ec 100644 --- a/pc.y +++ b/pc.y @@ -167,8 +167,18 @@ sub_prog_declaration sub_prog_head :FUNC ID arguments ':' standard_type ';' { + node *tmp; + int i = -1; + check_id(cur_scope->prev, $2); - scope_insert(cur_scope->prev, $2); + tmp = scope_insert(cur_scope->prev, $2); + + assert(tmp->func_info = malloc(sizeof struct fi)); + /*TODO add count of parameters*/ + tmp->func_info->argc = i; + assert(tmp->func_info->argv = malloc(i * sizeof int)); + + tmp->var_type = $5 cur_scope->ret_var = scope_insert(cur_scope, $2); cur_scope->ret_var->var_type = $5; -- cgit v1.1