aboutsummaryrefslogtreecommitdiff
path: root/src/tpc.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/tpc.y')
-rw-r--r--src/tpc.y20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/tpc.y b/src/tpc.y
index 74d31c6..6e733d0 100644
--- a/src/tpc.y
+++ b/src/tpc.y
@@ -2,11 +2,6 @@
2/* 2/*
3 * UPEM / Compilation / Projet 3 * UPEM / Compilation / Projet
4 * Pacien TRAN-GIRARD, Adam NAILI 4 * Pacien TRAN-GIRARD, Adam NAILI
5 *
6 * TODO :
7 * ------
8 * - arrays
9 *
10 */ 5 */
11 6
12int nb_globals = 0; 7int nb_globals = 0;
@@ -147,13 +142,7 @@ IfHandling: { gen_if_start($<num>$ = num_if++); };
147IfEndHandling: { gen_if_end($<num>-3); }; 142IfEndHandling: { gen_if_end($<num>-3); };
148IfElseEndHandling: { gen_ifelse_end($<num>-5); }; 143IfElseEndHandling: { gen_ifelse_end($<num>-5); };
149Exp: 144Exp:
150 LValue '=' Exp { 145 LValue '=' Exp { $$ = gen_assign($<ident>1, scope); }
151 if(loc_lookup($<ident>1) != TAB){
152 $$ = gen_assign($<ident>1, scope);
153 }else{
154 $$ = gen_assign_tab($<ident>1,scope);
155 }
156 }
157| EB 146| EB
158; 147;
159EB: 148EB:
@@ -184,12 +173,7 @@ F:
184 ADDSUB F { $$ = gen_signed_expr($1, $2); } 173 ADDSUB F { $$ = gen_signed_expr($1, $2); }
185| '!' F { $$ = gen_negate_expr($2); } 174| '!' F { $$ = gen_negate_expr($2); }
186| '(' Exp ')' { $$ = $2; } 175| '(' Exp ')' { $$ = $2; }
187| LValue { if(loc_lookup($<ident>1) != TAB){ 176| LValue { $$ = gen_value($<ident>1, scope); }
188 $$ = gen_value($<ident>1, scope);
189 }else{
190 $$ = gen_value_tab($<ident>1,scope);
191 }
192 }
193| NUM { $$ = gen_num($1, scope); } 177| NUM { $$ = gen_num($1, scope); }
194| CARACTERE { $$ = gen_char($1, scope); } 178| CARACTERE { $$ = gen_char($1, scope); }
195| IDENT '(' Arguments ')' { $$ = gen_function_call($<ident>1,$<num>3); } 179| IDENT '(' Arguments ')' { $$ = gen_function_call($<ident>1,$<num>3); }