diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2024-09-25 19:47:29 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2024-09-25 19:47:29 +0330 |
commit | c409b8aaf6b6f63bd68a3356e146ab80b2ec8c4b (patch) | |
tree | 65ea5801fd910fc6bcff3f2e8f06b5fd7d249c78 /src/compiler/code_generator | |
parent | f79290084948f3cf140395c270c07cf29ca58e8d (diff) |
fixed multiple variable definition bug
tried to implement import
Diffstat (limited to 'src/compiler/code_generator')
-rw-r--r-- | src/compiler/code_generator/code_generator.c | 6 | ||||
-rw-r--r-- | src/compiler/code_generator/code_generator.h | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/compiler/code_generator/code_generator.c b/src/compiler/code_generator/code_generator.c index 2b575d8..03901cd 100644 --- a/src/compiler/code_generator/code_generator.c +++ b/src/compiler/code_generator/code_generator.c @@ -61,7 +61,7 @@ void deleteInstructions(Instructions instructions) { free(instructions.instructions); } -Instructions codeGenerator(SourceCode code) { +Instructions codeGenerator(SourceCode *code) { ParsedTree *root = treeParser(code); if (root != NULL) { Instructions instructions = _codeGenerator(root, code); @@ -76,7 +76,7 @@ Instructions codeGenerator(SourceCode code) { return error; } -Instructions _codeGenerator(ParsedTree *root, SourceCode code) { +Instructions _codeGenerator(ParsedTree *root, SourceCode *code) { const TreeScopeMetadata *metadata = root->metadata; size_t instructions_size = 10; @@ -111,7 +111,7 @@ RETURN_ERROR: bool nodeToInstruction(ParsedTree *tree, Instruction **instructions, size_t *instructions_size, size_t *instructions_inserted, - SourceCode code) { + SourceCode *code) { switch (tree->token) { case TREE_TOKEN_FUNCTION_CALL: { const TreeFunctionCallMetadata *tree_metadata = tree->metadata; diff --git a/src/compiler/code_generator/code_generator.h b/src/compiler/code_generator/code_generator.h index 0f8b69d..0ae3219 100644 --- a/src/compiler/code_generator/code_generator.h +++ b/src/compiler/code_generator/code_generator.h @@ -36,12 +36,12 @@ extern void printInstructions(Instructions instructions); extern void deleteInstruction(Instruction instruction); extern void deleteInstructions(Instructions instructions); -extern Instructions codeGenerator(SourceCode code); -extern Instructions _codeGenerator(ParsedTree *root, SourceCode code); +extern Instructions codeGenerator(SourceCode *code); +extern Instructions _codeGenerator(ParsedTree *root, SourceCode *code); extern bool nodeToInstruction(ParsedTree *tree, Instruction **instructions, size_t *instructions_size, - size_t *instructions_inserted, SourceCode code); + size_t *instructions_inserted, SourceCode *code); extern void insertInstruction(const Instruction instruction, Instruction **restrict instructions, |