aboutsummaryrefslogtreecommitdiff
path: root/src/compiler/fasm_generator/fasm_generator.h
diff options
context:
space:
mode:
authorA404M <ahmadmahmoudiprogrammer@gmail.com>2024-10-08 04:16:27 +0330
committerA404M <ahmadmahmoudiprogrammer@gmail.com>2024-10-08 04:17:08 +0330
commitaddd54dc31603dc204773d3108dba4e000cd7657 (patch)
tree621620c4ca5634680d7655e3474cf0b0bcec8e01 /src/compiler/fasm_generator/fasm_generator.h
parentbf84010e01bb11874689ce53ea4df853b2e41c2b (diff)
added fasm support
added compiler options tried to compile to fasm first
Diffstat (limited to 'src/compiler/fasm_generator/fasm_generator.h')
-rw-r--r--src/compiler/fasm_generator/fasm_generator.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/compiler/fasm_generator/fasm_generator.h b/src/compiler/fasm_generator/fasm_generator.h
new file mode 100644
index 0000000..c6925ad
--- /dev/null
+++ b/src/compiler/fasm_generator/fasm_generator.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include <compiler/tree_parser/tree_parser.h>
+#include <fasm/lexer/lexer.h>
+#include <stdint.h>
+
+typedef struct FasmVariable {
+ TreeDefineVariableMetadata const *variable;
+ uint64_t value;
+ bool isGlobal;
+} FasmVariable;
+
+typedef struct FasmVariables {
+ FasmVariable *variables;
+ size_t size;
+} FasmVariables;
+
+extern FasmLines generateFasm(SourceCode *code);
+extern FasmLines generateFasmWithPrint(SourceCode *code);
+extern FasmLines _generateFasm(const ParsedTree *root, SourceCode *code);
+
+extern bool nodeToFasmLine(const ParsedTree *node, FasmLines *lines,
+ FasmVariables *variables[], size_t variables_size,
+ SourceCode *code);
+
+extern void pushFasmLine(FasmLines *lines, FasmLine line);
+
+extern size_t getSizeOfVariable(const TreeDefineVariableMetadata *variable);
+extern FasmVariable getVariableFasmKeyValue(
+ const TreeDefineVariableMetadata *variable, FasmVariables *variables[],
+ size_t variables_size);