From 0c0c7ab0850b6803c377ad7150305870d75bf3c0 Mon Sep 17 00:00:00 2001 From: kugwa Date: Wed, 30 Dec 2015 15:19:51 +0800 Subject: Add the code-generation phase --- src/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index 6516eab..5f6c169 100644 --- a/src/main.c +++ b/src/main.c @@ -5,6 +5,7 @@ typedef void* yyscan_t; #include "ast.h" +#include "code-generation.h" #include "common.h" #include "draw.h" #include "semantic-analysis.h" @@ -95,6 +96,14 @@ int main (int argc, char **argv) else exit(1); + FILE *asm_output = fopen("output.s", "w"); + if (asm_output == NULL) { + fprintf(stderr, "%s: output.s: %s\n", prog_name, ERR_MSG); + exit(1); + } + ccmmc_code_generation(state->ast, state->table, asm_output); + fclose(asm_output); + ccmmc_state_fini(state); fclose(source_handle); return 0; -- cgit v1.2.3