feat: implement AST walker
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
#ifndef FZL_WALKER_H
|
||||
#define FZL_WALKER_H
|
||||
|
||||
#include <common/fzl_opcodes.h>
|
||||
#include <compiler/fzl_parser.h>
|
||||
#include <compiler/utils/fzl_const_pool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
// 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_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
|
||||
Reference in New Issue
Block a user