feat: finish generator

This commit is contained in:
samsonium
2026-11-05 00:04:12 +03:00
parent 181458ecda
commit bd8272abc7
11 changed files with 744 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
#include <common/fzl_opcodes.h>
#include <compiler/fzl_parser.h>
#include <compiler/internals/gen.h>
#include <stdio.h>
// Unary math operations
gen_res_t gen_unary_math(fzl_gen_t *gen, fzl_node_t *node)
{
if (!gen || !node)
return gen_error;
gen_res_t res = gen_common(gen, node->unary_op.operand);
if (res.error)
return gen_error;
if (node->type == FZL_NODETYPE_UNARY_MINUS)
gen_op(gen, FZL_OPCODE_NEG);
return (gen_res_t){.error = false, .type = res.type, .classname = NULL};
}