Driver.h 857 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef QLOW_DRIVER_H
  2. #define QLOW_DRIVER_H
  3. #include <vector>
  4. #include <optional>
  5. #include <memory>
  6. #include <string>
  7. #include <utility>
  8. #include "Parser.h"
  9. namespace qlow
  10. {
  11. struct Options;
  12. class Driver;
  13. namespace ast {
  14. struct Ast;
  15. struct AstObject;
  16. }
  17. }
  18. struct qlow::Options
  19. {
  20. bool emitAssembly;
  21. bool emitLlvm;
  22. std::string outfile = "a.out";
  23. std::vector<std::string> infiles;
  24. int optLevel = 0;
  25. static Options parseOptions(int argc, char** argv);
  26. };
  27. class qlow::Driver
  28. {
  29. Options options;
  30. std::unique_ptr<qlow::ast::Ast> ast = nullptr;
  31. public:
  32. Driver(void) = delete;
  33. Driver(int argc, char** argv);
  34. int run(void);
  35. bool parseStage(void);
  36. qlow::ast::Ast parseFile(FILE* file, const std::string& filename);
  37. };
  38. #endif // QLOW_DRIVER_H