2023-12-09 17:24:41 +00:00
|
|
|
#ifndef RZ_COMPILER_H
|
|
|
|
#define RZ_COMPILER_H
|
|
|
|
|
|
|
|
#include "commons.h"
|
|
|
|
#include "err.h"
|
|
|
|
#include "mod.h"
|
|
|
|
#include "node.h"
|
|
|
|
#include "tysy.h"
|
2023-12-17 18:10:17 +00:00
|
|
|
#include "sym.h"
|
2023-12-09 17:24:41 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
mod_t* mod;
|
2023-12-17 18:10:17 +00:00
|
|
|
sym_t* sym;
|
2023-12-09 17:24:41 +00:00
|
|
|
tysy_t* tysy;
|
|
|
|
err_t* err;
|
2023-12-18 13:19:38 +00:00
|
|
|
|
|
|
|
int scope;
|
2023-12-09 17:24:41 +00:00
|
|
|
} compiler_t;
|
|
|
|
|
2023-12-17 18:10:17 +00:00
|
|
|
void compiler_init(compiler_t* compiler,
|
|
|
|
mod_t* mod,
|
|
|
|
sym_t* sym,
|
|
|
|
tysy_t* tysy,
|
|
|
|
err_t* err);
|
|
|
|
|
2023-12-09 17:24:41 +00:00
|
|
|
void compiler_free(compiler_t* compiler);
|
|
|
|
|
2023-12-17 18:10:17 +00:00
|
|
|
int compiler_run(compiler_t* compiler, node_t* node);
|
2023-12-18 18:34:31 +00:00
|
|
|
void compiler_run_if(compiler_t* compiler, node_t* node,
|
|
|
|
int* end_points, size_t* sz);
|
2023-12-09 17:24:41 +00:00
|
|
|
|
|
|
|
#endif
|