aboutsummaryrefslogtreecommitdiff
path: root/src/generator.c
diff options
context:
space:
mode:
authorpacien2018-06-06 14:14:55 +0200
committerpacien2018-06-06 14:14:55 +0200
commit01406ad25ff49d5c5f722f34187d2063cefea5ed (patch)
tree4d96a701aa1986abe79f2469ffd641c4123749bb /src/generator.c
parent64d73526bf9d39ad9d3f04509f6656abde2240fd (diff)
downloadtpc-compiler-01406ad25ff49d5c5f722f34187d2063cefea5ed.tar.gz
require main func and rename tests
Diffstat (limited to 'src/generator.c')
-rw-r--r--src/generator.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/generator.c b/src/generator.c
index bb95e08..44fdeab 100644
--- a/src/generator.c
+++ b/src/generator.c
@@ -79,7 +79,7 @@ void gen_prologue_continue(int *bss_done) {
79 *bss_done = 1; 79 *bss_done = 1;
80} 80}
81 81
82void gen_const_declaration() { 82void gen_epilogue() {
83 fprintf(output, "\n_start:\n"); 83 fprintf(output, "\n_start:\n");
84 fprintf(output, "push rbp\nmov rbp, rsp\n\n"); 84 fprintf(output, "push rbp\nmov rbp, rsp\n\n");
85 fprintf(output, "call main\n"); 85 fprintf(output, "call main\n");
@@ -92,6 +92,9 @@ void gen_const_declaration() {
92 loc_display_table(); 92 loc_display_table();
93 fprintf(output, ";function table\n"); 93 fprintf(output, ";function table\n");
94 fun_display_table(); 94 fun_display_table();
95
96 // require a main function
97 fun_lookup("main", 0);
95} 98}
96 99
97void gen_const(const char name[], int value, Scope scope) { 100void gen_const(const char name[], int value, Scope scope) {