// Standard includes #include //LLVM includes #include "llvm/Support/TargetSelect.h" #include "KaleidoscopeJIT.h" // Local includes #include "Ast.h" #include "Parser.h" #include "JIT.h" using namespace parser; using namespace jit; namespace helper { // Cloning make_unique here until it's standard in C++14. // Using a namespace to avoid conflicting with MSVC's std::make_unique (which // ADL can sometimes find in unqualified calls). template static typename std::enable_if::value, std::unique_ptr>::type make_unique(Args &&... args) { return std::unique_ptr(new T(std::forward(args)...)); } } //===----------------------------------------------------------------------===// // "Library" functions that can be "extern'd" from user code. //===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===// // Main driver code. //===----------------------------------------------------------------------===// int main() { InitializeNativeTarget(); InitializeNativeTargetAsmPrinter(); InitializeNativeTargetAsmParser(); JITObjects::TheJIT = llvm::make_unique(); jit::InitializeModuleAndPassManager(); // Prime the first token. fprintf(stderr, "ready> "); getNextToken(); // Run the main "interpreter loop" now. MainLoop(); AstObjects::TheModule->dump(); return 0; }