ccm/lib/compiler.h

43 lines
975 B
C
Raw Normal View History

2024-03-18 17:20:40 +00:00
#ifndef CCM_COMPILER_H
#define CCM_COMPILER_H
#include "commons.h"
#include "bytecode.h"
#include "prog.h"
#include "node.h"
#include "err.h"
#include "module.h"
2024-03-22 22:01:20 +00:00
typedef struct {
int start_point;
vec_t to_end;
} loop_info_t;
2024-03-18 17:20:40 +00:00
typedef struct {
module_t* module;
err_t err;
2024-03-21 11:00:20 +00:00
int loc_counter;
2024-03-22 22:01:20 +00:00
vec_t loop_infos;
2024-03-18 17:20:40 +00:00
} compiler_t;
void compiler_init(compiler_t* self, module_t* module);
void compiler_free(compiler_t* self);
2024-03-19 06:11:28 +00:00
void compiler_compile(compiler_t* self,
node_t* node,
2024-03-18 17:20:40 +00:00
prog_t* prog);
2024-03-19 06:11:28 +00:00
void compiler_compile_or(compiler_t* self,
node_t* node,
prog_t* prog);
void compiler_compile_and(compiler_t* self,
node_t* node,
prog_t* prog);
2024-03-22 15:33:41 +00:00
void compiler_compile_if(compiler_t* self,
node_t* node,
prog_t* prog,
vec_t* to_end);
2024-03-18 17:20:40 +00:00
#endif