wip: working on variables

This commit is contained in:
samsonium
2026-10-11 19:11:49 +03:00
parent 01afe2e972
commit 2c76277a68
8 changed files with 215 additions and 72 deletions
+6
View File
@@ -8,6 +8,12 @@ typedef enum
FZL_OPCODE_CALL_BUILTIN = 0xF00002, // Call builtin function
FZL_OPCODE_PUSHNUM = 0xF00003, // Push number into stack
FZL_OPCODE_MK_ENVTABLE = 0xF10001, // Allocate new environment table
FZL_OPCODE_RM_ENVTABLE = 0xF10002, // Free environment table
FZL_OPCODE_STORE = 0xF10003, // Push variable to environment table
FZL_OPCODE_LOOKUP_ENV = 0xF10004, // Lookup name in environment table
FZL_OPCODE_WRITE = 0xF10005, // Wirte into variable
FZL_OPCODE_ADD = 0xA00001, // Sum two numbers in arg strack
FZL_OPCODE_SUB = 0xA00002, // Subract two numbers in arg stack
FZL_OPCODE_MUL = 0xA00003, // Multiply two numbers in arg stack
+7
View File
@@ -65,6 +65,13 @@ typedef struct fzl_node
{
struct fzl_node *operand;
} unary_op;
// Variables declaration and initializing
struct
{
fzl_token_t *type;
struct fzl_node *identifier;
} var;
};
} fzl_node_t;