40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
|
#pragma once
|
||
|
#include "binop.hpp"
|
||
|
#include "parse_driver.hpp"
|
||
|
#include "definition.hpp"
|
||
|
#include "type_env.hpp"
|
||
|
#include "type.hpp"
|
||
|
#include "global_scope.hpp"
|
||
|
#include "mangler.hpp"
|
||
|
#include "llvm_context.hpp"
|
||
|
|
||
|
class compiler {
|
||
|
private:
|
||
|
std::map<binop, std::string> binop_names;
|
||
|
file_mgr file_m;
|
||
|
definition_group global_defs;
|
||
|
parse_driver driver;
|
||
|
mangler mng;
|
||
|
global_scope global_scp;
|
||
|
type_env_ptr global_env;
|
||
|
type_mgr type_m;
|
||
|
llvm_context ctx;
|
||
|
|
||
|
void add_default_types();
|
||
|
void add_binop_type(binop op, type_ptr type);
|
||
|
void add_default_function_types();
|
||
|
void parse();
|
||
|
void typecheck();
|
||
|
void translate();
|
||
|
void compile();
|
||
|
void create_llvm_binop(binop op);
|
||
|
void create_llvm_bool(bool b);
|
||
|
void generate_llvm();
|
||
|
void output_llvm(const std::string& into);
|
||
|
public:
|
||
|
compiler(const std::string& filename);
|
||
|
void operator()(const std::string& into);
|
||
|
file_mgr& get_file_manager();
|
||
|
type_mgr& get_type_manager();
|
||
|
};
|