From 01406ad25ff49d5c5f722f34187d2063cefea5ed Mon Sep 17 00:00:00 2001 From: pacien Date: Wed, 6 Jun 2018 14:14:55 +0200 Subject: require main func and rename tests --- src/generator.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/generator.c') 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) { *bss_done = 1; } -void gen_const_declaration() { +void gen_epilogue() { fprintf(output, "\n_start:\n"); fprintf(output, "push rbp\nmov rbp, rsp\n\n"); fprintf(output, "call main\n"); @@ -92,6 +92,9 @@ void gen_const_declaration() { loc_display_table(); fprintf(output, ";function table\n"); fun_display_table(); + + // require a main function + fun_lookup("main", 0); } void gen_const(const char name[], int value, Scope scope) { -- cgit v1.2.3