From 53e859913d6eb7141dbd1ed48f28c336f1322534 Mon Sep 17 00:00:00 2001 From: Adam NAILI Date: Tue, 5 Jun 2018 14:09:01 +0200 Subject: Replacing VOID by VOID_T --- src/tpc.y | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/tpc.y') diff --git a/src/tpc.y b/src/tpc.y index 3bd3df4..dc6bc4f 100644 --- a/src/tpc.y +++ b/src/tpc.y @@ -20,7 +20,7 @@ extern int lineno; int yylex(); void yyerror(char *); static Scope scope = GLOBAL; -static Type return_type = VOID; +static Type return_type = VOID_T; static int bss_done = 0; static int num_label = 0; static int num_if = 0; @@ -89,11 +89,11 @@ DeclFoncts: ; DeclFonct: EnTeteFonct { scope = LOCAL; } - Corps { gen_function_end_declaration(); scope = GLOBAL; return_type = VOID; } + Corps { gen_function_end_declaration(); scope = GLOBAL; return_type = VOID_T; } ; EnTeteFonct: TYPE IDENT PrologueCont '(' Parametres ')' { return_type = gen_function_declaration($2, $1, $5); } -| VOID IDENT PrologueCont '(' Parametres ')' { return_type = gen_function_declaration($2, VOID, $5); } +| VOID IDENT PrologueCont '(' Parametres ')' { return_type = gen_function_declaration($2, VOID_T, $5); } ; PrologueCont: {gen_prologue_continue(&bss_done);}; @@ -116,8 +116,8 @@ SuiteInstr: Instr: Exp ';' | ';' -| RETURN Exp ';' { gen_function_return(return_type, $2); scope = GLOBAL; return_type = VOID; } -| RETURN ';' { gen_function_return(return_type, VOID); scope = GLOBAL; return_type = VOID; } +| RETURN Exp ';' { gen_function_return(return_type, $2); scope = GLOBAL; return_type = VOID_T; } +| RETURN ';' { gen_function_return(return_type, VOID_T); scope = GLOBAL; return_type = VOID_T; } | READE '(' IDENT ')' ';' { gen_reade($3); } | READC '(' IDENT ')' ';' { gen_readc($3); } | PRINT '(' Exp ')' ';' { gen_print($3);} @@ -164,7 +164,7 @@ F: | LValue { $$ = gen_value($1, scope); } | NUM { $$ = gen_num($1, scope); } | CARACTERE { $$ = gen_char($1, scope); } -| IDENT '(' Arguments ')' { $$ = gen_function_call($1,$3);} +| IDENT '(' Arguments ')' { return_type = fun_lookup($1,$3);$$ = gen_function_call($1,$3); } ; LValue: IDENT { gen_check($1, scope); } -- cgit v1.2.3