From addd54dc31603dc204773d3108dba4e000cd7657 Mon Sep 17 00:00:00 2001 From: A404M Date: Tue, 8 Oct 2024 04:16:27 +0330 Subject: added fasm support added compiler options tried to compile to fasm first --- src/compiler/code_generator/code_generator.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/compiler/code_generator/code_generator.c') diff --git a/src/compiler/code_generator/code_generator.c b/src/compiler/code_generator/code_generator.c index 75b89c6..bf77419 100644 --- a/src/compiler/code_generator/code_generator.c +++ b/src/compiler/code_generator/code_generator.c @@ -76,6 +76,24 @@ Instructions codeGenerator(SourceCode *code) { return error; } +Instructions codeGeneratorWithPrint(SourceCode *code) { + ParsedTree *root = treeParserWithPrint(code); + if (root != NULL) { + printf("----tree parsed:\n"); + printParsedTreeNode(root); + Instructions instructions = _codeGenerator(root, code); + + deleteParsedTree(root); + return instructions; + } + fprintf(stderr, "error in tree parser\n"); + const Instructions error = { + .instructions = NULL, + .size = ERROR_SIZE, + }; + return error; +} + Instructions _codeGenerator(ParsedTree *root, SourceCode *code) { const TreeScopeMetadata *metadata = root->metadata; @@ -112,6 +130,7 @@ RETURN_ERROR: bool nodeToInstruction(ParsedTree *tree, Instruction **instructions, size_t *instructions_size, size_t *instructions_inserted, SourceCode *code) { + /*printf("Parsing token = %s\n", TREE_TOKEN_STRINGS[tree->token]);*/ switch (tree->token) { case TREE_TOKEN_FUNCTION_CALL: { const TreeFunctionCallMetadata *tree_metadata = tree->metadata; -- cgit v1.2.3