diff options
Diffstat (limited to 'src/code-generation.c')
-rw-r--r-- | src/code-generation.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/code-generation.c b/src/code-generation.c index 294389f..445d03b 100644 --- a/src/code-generation.c +++ b/src/code-generation.c @@ -8,6 +8,34 @@ #include <stdio.h> #include <stdlib.h> +static void generate_global_variable(CcmmcAst *global, CcmmcState *state) +{ +} + +static void generate_function(CcmmcAst *funcion, CcmmcState *state) +{ +} + +static void generate_program(CcmmcState *state) +{ + for (CcmmcAst *global_decl = state->ast->child; global_decl != NULL; + global_decl = global_decl->right_sibling) { + switch (global_decl->value_decl.kind) { + case CCMMC_KIND_DECL_VARIABLE: + generate_global_variable(global_decl, state); + break; + case CCMMC_KIND_DECL_FUNCTION: + generate_function(global_decl, state); + break; + case CCMMC_KIND_DECL_FUNCTION_PARAMETER: + case CCMMC_KIND_DECL_TYPE: + default: + assert(false); + } + } +} + void ccmmc_code_generation(CcmmcState *state) { + generate_program(state); } |