feat: finish generator
This commit is contained in:
@@ -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};
|
||||
}
|
||||
Reference in New Issue
Block a user