See More

#ifndef LFORTRAN_PYTHON_EVALUATOR_H #define LFORTRAN_PYTHON_EVALUATOR_H #include #include #include #include #include #include #include #include #include namespace LCompilers { class LLVMModule; class LLVMEvaluator; /* PythonCompiler is the main class to access the Python compiler. This class is used for both interactive (.evaluate()) and non-interactive (.get_llvm2()) compilation. The methods return diagnostic messages (errors, warnings, style suggestions, ...) as an argument. One can use Diagnostic::render to render them. One can use get_asr2() to obtain the ASR and then hand it over to other backends by hand. */ class PythonCompiler { public: PythonCompiler(CompilerOptions compiler_options); ~PythonCompiler(); struct EvalResult { enum { integer4, integer8, real4, real8, complex4, complex8, statement, none } type; union { int32_t i32; int64_t i64; float f32; double f64; struct {float re, im;} c32; struct {double re, im;} c64; }; std::string ast; std::string asr; std::string llvm_ir; }; Result<:unique_ptr>> get_llvm3(ASR::TranslationUnit_t &asr, LCompilers::PassManager& lpm, diag::Diagnostics &diagnostics, const std::string &infile); private: Allocator al; #ifdef HAVE_LFORTRAN_LLVM std::unique_ptr e; int eval_count; #endif CompilerOptions compiler_options; // SymbolTable *symbol_table; std::string run_fn; }; } // namespace LCompilers #endif // LFORTRAN_PYTHON_EVALUATOR_H