diff options
author | pacien | 2018-06-06 14:14:55 +0200 |
---|---|---|
committer | pacien | 2018-06-06 14:14:55 +0200 |
commit | 01406ad25ff49d5c5f722f34187d2063cefea5ed (patch) | |
tree | 4d96a701aa1986abe79f2469ffd641c4123749bb /src/generator.c | |
parent | 64d73526bf9d39ad9d3f04509f6656abde2240fd (diff) | |
download | tpc-compiler-01406ad25ff49d5c5f722f34187d2063cefea5ed.tar.gz |
require main func and rename tests
Diffstat (limited to 'src/generator.c')
-rw-r--r-- | src/generator.c | 5 |
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 | ||
82 | void gen_const_declaration() { | 82 | void 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 | ||
97 | void gen_const(const char name[], int value, Scope scope) { | 100 | void gen_const(const char name[], int value, Scope scope) { |