#ifndef FZL_WALKER_H #define FZL_WALKER_H #include #include #include #include #include #include #include #include // Type of context typedef enum { FZL_WALK_CTX_TYPE_GLOBAL, FZL_WALK_CTX_TYPE_FN, FZL_WALK_CTX_TYPE_CLASS, FZL_WALK_CTX_TYPE_ASSIGN } fzl_walk_ctx_type_t; // Internal walk function result typedef struct { fzl_type_t type; char *error_msg; bool error; char *classname; } fzl_walk_res_t; // Function context descriptor typedef struct fzl_walk_ctx { fzl_walk_ctx_type_t type; struct fzl_walk_ctx *parent; fzl_node_t *fn; size_t initial_env_lvl; } fzl_walk_ctx_t; // Walker descriptor typedef struct { fzl_node_t *root; fzl_const_hash_pool_t *consts; uint64_t *ops; size_t op_count; size_t op_remainder; fzl_symtable_t *syms[64]; size_t sym_top; fzl_walk_ctx_t *ctx; fzl_ctable_t *classes[64]; size_t classes_count; } fzl_walker_t; // Allocate new walker fzl_walker_t *fzl_mkwalker(fzl_node_t *root); // Walk throught the entire AST and build: // 1. Constants table // 2. Operations int fzl_walk(fzl_walker_t *walker); // Get last error message char *fzl_walker_geterror(); // Free walker void fzl_freewalker(fzl_walker_t *walker); #endif // FZL_WALKER_H