diff options
Diffstat (limited to 'willow/tools/willowc/include/compiler.hpp')
| -rw-r--r-- | willow/tools/willowc/include/compiler.hpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/willow/tools/willowc/include/compiler.hpp b/willow/tools/willowc/include/compiler.hpp new file mode 100644 index 0000000..96ca480 --- /dev/null +++ b/willow/tools/willowc/include/compiler.hpp @@ -0,0 +1,40 @@ +#ifndef WILLOWC_INCLUDE_COMPILER_HPP +#define WILLOWC_INCLUDE_COMPILER_HPP + +#include <sourcemanager.hpp> + +#include <willow/IR/DiagnosticEngine.h> +#include <string> + +namespace willowc { + +class Compiler { +public: + struct Options { + std::string filename; + bool use_stdin; + willow::Severity log_level; + }; + Compiler(); + Compiler(const Compiler &) = delete; + Compiler &operator=(const Compiler &) = delete; + + willow::LogicalResult addSourceFile(const std::string &path); + willow::LogicalResult addStdIn(); + // TODO + void run(); + void compile(FileID file); + + void setLogLevel(willow::Severity sev) { log_level_ = sev; } + size_t numFiles() { return sourcemanager_.numFiles(); } +private: + SourceManager sourcemanager_; + willow::Severity log_level_; + willow::DiagnosticEngine diagnostic_engine_; + + void emitDiagnostic(const willow::Diagnostic &d); +}; + +}; // namespace willowc + +#endif // WILLOWC_INCLUDE_COMPILER_HPP |