diff options
author | Adam NAILI | 2018-06-05 14:56:02 +0200 |
---|---|---|
committer | Adam NAILI | 2018-06-05 14:56:02 +0200 |
commit | 0255cca32a78847d2de0134740b991a77f5ad555 (patch) | |
tree | ba2bb6bfa74fa63ef75ab31db2b3cdb8b2e0123d /src | |
parent | 53e859913d6eb7141dbd1ed48f28c336f1322534 (diff) | |
download | tpc-compiler-0255cca32a78847d2de0134740b991a77f5ad555.tar.gz |
Return test
Diffstat (limited to 'src')
-rw-r--r-- | src/generator.c | 2 | ||||
-rw-r--r-- | src/tpc.y | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/generator.c b/src/generator.c index d5df545..1181ac7 100644 --- a/src/generator.c +++ b/src/generator.c | |||
@@ -97,7 +97,7 @@ Type gen_function_declaration(const char name[], int return_type, int nb_param) | |||
97 | } | 97 | } |
98 | 98 | ||
99 | void gen_function_end_declaration() { | 99 | void gen_function_end_declaration() { |
100 | fprintf(output, "mov rsp, rbp\npop rbp\nret\n"); | 100 | fprintf(output, "mov rsp, rbp\npop rbp\nret\n"); |
101 | } | 101 | } |
102 | 102 | ||
103 | void gen_function_return(Type expect, Type actual) { | 103 | void gen_function_return(Type expect, Type actual) { |
@@ -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 ')' { return_type = fun_lookup($<ident>1,$<num>3);$$ = gen_function_call($<ident>1,$<num>3); } | 167 | | IDENT '(' Arguments ')' { $$ = 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); } |