2024-03-31 21:10:56 +00:00
|
|
|
#ifndef SK_COMPILER_H
|
|
|
|
#define SK_COMPILER_H
|
|
|
|
|
|
|
|
#include "commons.h"
|
|
|
|
#include "prog.h"
|
2024-04-02 15:33:31 +00:00
|
|
|
#include "sym.h"
|
2024-03-31 21:10:56 +00:00
|
|
|
|
|
|
|
struct compiler
|
|
|
|
{
|
2024-04-03 04:28:03 +00:00
|
|
|
struct vec var_names;
|
2024-03-31 21:10:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void compiler_init(struct compiler* self);
|
|
|
|
void compiler_free(struct compiler* self);
|
|
|
|
|
|
|
|
void compiler_compile(struct compiler* self,
|
|
|
|
struct node* node,
|
2024-04-02 15:33:31 +00:00
|
|
|
struct prog* prog,
|
|
|
|
struct sym* sym);
|
2024-03-31 21:10:56 +00:00
|
|
|
|
2024-03-31 23:32:47 +00:00
|
|
|
void compiler_compile_children(struct compiler* self,
|
|
|
|
struct node* node,
|
2024-04-02 15:33:31 +00:00
|
|
|
struct prog* prog,
|
|
|
|
struct sym* sym);
|
2024-04-01 12:00:06 +00:00
|
|
|
|
|
|
|
void compiler_compile_value(struct compiler* self,
|
|
|
|
struct node* node,
|
|
|
|
struct prog* prog,
|
|
|
|
TypeKind type,
|
|
|
|
union val val);
|
|
|
|
|
|
|
|
void compiler_compile_and(struct compiler* self,
|
|
|
|
struct node* node,
|
2024-04-02 15:33:31 +00:00
|
|
|
struct prog* prog,
|
|
|
|
struct sym* sym);
|
2024-04-01 12:00:06 +00:00
|
|
|
|
|
|
|
void compiler_compile_or(struct compiler* self,
|
2024-04-02 15:33:31 +00:00
|
|
|
struct node* node,
|
|
|
|
struct prog* prog,
|
|
|
|
struct sym* sym);
|
2024-04-02 17:16:22 +00:00
|
|
|
|
|
|
|
void compiler_compile_if(struct compiler* self,
|
|
|
|
struct node* node,
|
|
|
|
struct prog* prog,
|
|
|
|
struct sym* sym,
|
|
|
|
struct vec* to_end);
|
2024-03-31 21:10:56 +00:00
|
|
|
#endif
|
|
|
|
|