34 lines
701 B
C++
34 lines
701 B
C++
#pragma once
|
|
|
|
#include "antlr4-runtime.h"
|
|
#include "HooLexer.h"
|
|
#include "HooParser.h"
|
|
#include "Visitor.hpp"
|
|
#include "ParseErrorHandler.hpp"
|
|
|
|
#include <string>
|
|
#include <memory>
|
|
|
|
class Compiler
|
|
{
|
|
private:
|
|
const std::string &_input;
|
|
const std::string &_moduleName;
|
|
antlr4::ANTLRInputStream *_input_stream;
|
|
HooLexer *_lexer;
|
|
antlr4::CommonTokenStream *_tokens;
|
|
HooParser *_parser;
|
|
Visitor *_visitor;
|
|
|
|
public:
|
|
Compiler(const std::string &input, const std::string &moduleName);
|
|
~Compiler();
|
|
|
|
public:
|
|
std::any compile();
|
|
antlr4::tree::ParseTree *parse();
|
|
|
|
public:
|
|
std::shared_ptr<llvm::LLVMContext> getContext() const { return _visitor->getContext(); }
|
|
};
|