diff options
author | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-02-23 18:12:27 +0330 |
---|---|---|
committer | A404M <ahmadmahmoudiprogrammer@gmail.com> | 2025-02-23 18:13:55 +0330 |
commit | 1d13c72fb9fb40e35c64713a9176d263ad5fe09d (patch) | |
tree | b6f851f94274e079b035223df3e67963409aa98e /src/compiler/code-generator.h | |
parent | 8e5ac02b143588f598a058f5a5ae44181e493ef4 (diff) |
clean up
Diffstat (limited to 'src/compiler/code-generator.h')
-rw-r--r-- | src/compiler/code-generator.h | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/src/compiler/code-generator.h b/src/compiler/code-generator.h deleted file mode 100644 index 3c3222a..0000000 --- a/src/compiler/code-generator.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include "compiler/ast-tree.h" -#include <stddef.h> -#include <stdint.h> - -typedef enum CodeGeneratorInstruction : uint8_t { - CODE_GENERATOR_INSTRUCTION_PRINT_U64, - CODE_GENERATOR_INSTRUCTION_CALL, - CODE_GENERATOR_INSTRUCTION_RET, - CODE_GENERATOR_INSTRUCTION_MOV, - CODE_GENERATOR_INSTRUCTION_ADD, - CODE_GENERATOR_INSTRUCTION_FUNCTION_BEGIN, - CODE_GENERATOR_INSTRUCTION_FUNCTION_END, -} CodeGeneratorInstruction; - -typedef struct CodeGeneratorCode { - char *label_begin; - char *label_end; - CodeGeneratorInstruction instruction; - void *metadata; -} CodeGeneratorCode; - -typedef struct CodeGeneratorCall { - char *label_begin; - char *label_end; -} CodeGeneratorCall; - -typedef struct CodeGeneratorOperand { - union { - uint64_t value; - char *reference; - } value; - bool isReference; -} CodeGeneratorOperand; - -typedef struct CodeGeneratorDoubleOperand { - CodeGeneratorOperand op0; - CodeGeneratorOperand op1; -} CodeGeneratorDoubleOperand; - -typedef struct CodeGeneratorMov { - CodeGeneratorOperand op0; - CodeGeneratorOperand op1; - size_t bytes; -} CodeGeneratorMov; - -typedef struct CodeGeneratorFunctionBegin { - char *name_begin; - char *name_end; -} CodeGeneratorFunctionBegin; - -typedef struct CodeGeneratorFunctionEnd { - char *name_begin; - char *name_end; -} CodeGeneratorFunctionEnd; - -typedef struct CodeGeneratorDefine { - char *label_begin; - char *label_end; - CodeGeneratorOperand operand; - size_t bytes; -} CodeGeneratorDefine; - -typedef struct CodeGeneratorCodes { - CodeGeneratorCode *codes; - size_t codes_size; - CodeGeneratorDefine *defines; - size_t defines_size; -} CodeGeneratorCodes; - -void codeGeneratorOperandDestroy(CodeGeneratorOperand operand); -void codeGeneratorDelete(CodeGeneratorCodes *code); - -CodeGeneratorOperand *newCodeGeneratorOperand(void *value, bool isReference); -CodeGeneratorOperand makeCodeGeneratorOperand(void *value, bool isReference); - -CodeGeneratorFunctionBegin *newCodeGeneratorFunctionBegin(char *name_begin,char *name_end); -CodeGeneratorFunctionEnd *newCodeGeneratorFunctionEnd(char *name_begin,char *name_end); - -CodeGeneratorOperand *newCodeGeneratorOperandFromAstTree(AstTree tree); - -CodeGeneratorCode createGenerateCode(char *label_begin, char *label_end, - CodeGeneratorInstruction instruction, - void *metadata); - -CodeGeneratorDefine createGenerateDefine(char *label_begin, char *label_end, - CodeGeneratorOperand operand, - size_t bytes); - -CodeGeneratorCode *newGenerateCode(char *label_begin, char *label_end, - CodeGeneratorInstruction instruction); - -void generateCodePushCode(CodeGeneratorCodes *codes, CodeGeneratorCode code); -void generateCodePushDefine(CodeGeneratorCodes *codes, - CodeGeneratorDefine define); - -CodeGeneratorCodes *codeGenerator(AstTreeRoot *astTreeRoot); - -bool codeGeneratorAstTreeFunction(char *label_begin, char *label_end, - AstTree astTree, CodeGeneratorCodes *codes); - -char *codeGeneratorToFlatASM(const CodeGeneratorCodes *codes); - -bool codeGeneratorFlatASMExec(const char *filePath, const char *fasm); |