Main.cpp 930 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Standard includes
  2. #include <cstdio>
  3. // Local includes
  4. #include "Ast.h"
  5. #include "Parser.h"
  6. using namespace parser;
  7. namespace helper {
  8. // Cloning make_unique here until it's standard in C++14.
  9. // Using a namespace to avoid conflicting with MSVC's std::make_unique (which
  10. // ADL can sometimes find in unqualified calls).
  11. template <class T, class... Args>
  12. static
  13. typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
  14. make_unique(Args &&... args) {
  15. return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
  16. }
  17. }
  18. //===----------------------------------------------------------------------===//
  19. // Main driver code.
  20. //===----------------------------------------------------------------------===//
  21. int main() {
  22. // Prime the first token.
  23. fprintf(stderr, "ready> ");
  24. getNextToken();
  25. // Run the main "interpreter loop" now.
  26. MainLoop();
  27. AstObjects::TheModule->dump();
  28. return 0;
  29. }