diff options
Diffstat (limited to 'src/tpc.y')
-rw-r--r-- | src/tpc.y | 20 |
1 files changed, 2 insertions, 18 deletions
@@ -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 | ||
12 | int nb_globals = 0; | 7 | int nb_globals = 0; |
@@ -147,13 +142,7 @@ IfHandling: { gen_if_start($<num>$ = num_if++); }; | |||
147 | IfEndHandling: { gen_if_end($<num>-3); }; | 142 | IfEndHandling: { gen_if_end($<num>-3); }; |
148 | IfElseEndHandling: { gen_ifelse_end($<num>-5); }; | 143 | IfElseEndHandling: { gen_ifelse_end($<num>-5); }; |
149 | Exp: | 144 | Exp: |
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 | ; |
159 | EB: | 148 | EB: |
@@ -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); } |