diff options
Diffstat (limited to 'src/tpc.y')
-rw-r--r-- | src/tpc.y | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -20,7 +20,7 @@ extern int lineno; | |||
20 | int yylex(); | 20 | int yylex(); |
21 | void yyerror(char *); | 21 | void yyerror(char *); |
22 | static Scope scope = GLOBAL; | 22 | static Scope scope = GLOBAL; |
23 | static Type return_type = VOID; | 23 | static Type return_type = VOID_T; |
24 | static int bss_done = 0; | 24 | static int bss_done = 0; |
25 | static int num_label = 0; | 25 | static int num_label = 0; |
26 | static int num_if = 0; | 26 | static int num_if = 0; |
@@ -89,11 +89,11 @@ DeclFoncts: | |||
89 | ; | 89 | ; |
90 | DeclFonct: | 90 | DeclFonct: |
91 | EnTeteFonct { scope = LOCAL; } | 91 | EnTeteFonct { scope = LOCAL; } |
92 | Corps { gen_function_end_declaration(); scope = GLOBAL; return_type = VOID; } | 92 | Corps { gen_function_end_declaration(); scope = GLOBAL; return_type = VOID_T; } |
93 | ; | 93 | ; |
94 | EnTeteFonct: | 94 | EnTeteFonct: |
95 | TYPE IDENT PrologueCont '(' Parametres ')' { return_type = gen_function_declaration($<ident>2, $<type>1, $5); } | 95 | TYPE IDENT PrologueCont '(' Parametres ')' { return_type = gen_function_declaration($<ident>2, $<type>1, $5); } |
96 | | VOID IDENT PrologueCont '(' Parametres ')' { return_type = gen_function_declaration($<ident>2, VOID, $5); } | 96 | | VOID IDENT PrologueCont '(' Parametres ')' { return_type = gen_function_declaration($<ident>2, VOID_T, $5); } |
97 | ; | 97 | ; |
98 | 98 | ||
99 | PrologueCont: {gen_prologue_continue(&bss_done);}; | 99 | PrologueCont: {gen_prologue_continue(&bss_done);}; |
@@ -116,8 +116,8 @@ SuiteInstr: | |||
116 | Instr: | 116 | Instr: |
117 | Exp ';' | 117 | Exp ';' |
118 | | ';' | 118 | | ';' |
119 | | RETURN Exp ';' { gen_function_return(return_type, $<type>2); scope = GLOBAL; return_type = VOID; } | 119 | | RETURN Exp ';' { gen_function_return(return_type, $<type>2); scope = GLOBAL; return_type = VOID_T; } |
120 | | RETURN ';' { gen_function_return(return_type, VOID); scope = GLOBAL; return_type = VOID; } | 120 | | RETURN ';' { gen_function_return(return_type, VOID_T); scope = GLOBAL; return_type = VOID_T; } |
121 | | READE '(' IDENT ')' ';' { gen_reade($<ident>3); } | 121 | | READE '(' IDENT ')' ';' { gen_reade($<ident>3); } |
122 | | READC '(' IDENT ')' ';' { gen_readc($<ident>3); } | 122 | | READC '(' IDENT ')' ';' { gen_readc($<ident>3); } |
123 | | PRINT '(' Exp ')' ';' { gen_print($<type>3);} | 123 | | PRINT '(' Exp ')' ';' { gen_print($<type>3);} |
@@ -164,7 +164,7 @@ F: | |||
164 | | LValue { $$ = gen_value($<ident>1, scope); } | 164 | | LValue { $$ = gen_value($<ident>1, scope); } |
165 | | NUM { $$ = gen_num($1, scope); } | 165 | | NUM { $$ = gen_num($1, scope); } |
166 | | CARACTERE { $$ = gen_char($1, scope); } | 166 | | CARACTERE { $$ = gen_char($1, scope); } |
167 | | IDENT '(' Arguments ')' { $$ = gen_function_call($<ident>1,$<num>3);} | 167 | | IDENT '(' Arguments ')' { return_type = fun_lookup($<ident>1,$<num>3);$$ = gen_function_call($<ident>1,$<num>3); } |
168 | ; | 168 | ; |
169 | LValue: | 169 | LValue: |
170 | IDENT { gen_check($<ident>1, scope); } | 170 | IDENT { gen_check($<ident>1, scope); } |