aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam NAILI2018-06-05 14:56:02 +0200
committerAdam NAILI2018-06-05 14:56:02 +0200
commit0255cca32a78847d2de0134740b991a77f5ad555 (patch)
treeba2bb6bfa74fa63ef75ab31db2b3cdb8b2e0123d /src
parent53e859913d6eb7141dbd1ed48f28c336f1322534 (diff)
downloadtpc-compiler-0255cca32a78847d2de0134740b991a77f5ad555.tar.gz
Return test
Diffstat (limited to 'src')
-rw-r--r--src/generator.c2
-rw-r--r--src/tpc.y2
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
99void gen_function_end_declaration() { 99void 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
103void gen_function_return(Type expect, Type actual) { 103void gen_function_return(Type expect, Type actual) {
diff --git a/src/tpc.y b/src/tpc.y
index dc6bc4f..14b0ef3 100644
--- a/src/tpc.y
+++ b/src/tpc.y
@@ -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;
169LValue: 169LValue:
170 IDENT { gen_check($<ident>1, scope); } 170 IDENT { gen_check($<ident>1, scope); }