aboutsummaryrefslogtreecommitdiff
path: root/src/tpc.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/tpc.y')
-rw-r--r--src/tpc.y12
1 files changed, 6 insertions, 6 deletions
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;
20int yylex(); 20int yylex();
21void yyerror(char *); 21void yyerror(char *);
22static Scope scope = GLOBAL; 22static Scope scope = GLOBAL;
23static Type return_type = VOID; 23static Type return_type = VOID_T;
24static int bss_done = 0; 24static int bss_done = 0;
25static int num_label = 0; 25static int num_label = 0;
26static int num_if = 0; 26static int num_if = 0;
@@ -89,11 +89,11 @@ DeclFoncts:
89; 89;
90DeclFonct: 90DeclFonct:
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;
94EnTeteFonct: 94EnTeteFonct:
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
99PrologueCont: {gen_prologue_continue(&bss_done);}; 99PrologueCont: {gen_prologue_continue(&bss_done);};
@@ -116,8 +116,8 @@ SuiteInstr:
116Instr: 116Instr:
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;
169LValue: 169LValue:
170 IDENT { gen_check($<ident>1, scope); } 170 IDENT { gen_check($<ident>1, scope); }