123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #include "llvm/ADT/STLExtras.h"
- #include "llvm/IR/IRBuilder.h"
- #include "llvm/IR/LLVMContext.h"
- #include "llvm/IR/Module.h"
- #include "llvm/IR/Verifier.h"
- #include <cctype>
- #include <cstdio>
- #include <map>
- #include <string>
- #include <vector>
- #include "Ast.h"
- #include "Lexer.h"
- #include "Parser.h"
- using namespace llvm;
- using namespace ast;
- using namespace lexer;
- using namespace parser;
- 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 <class T, class... Args>
- static
- typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
- make_unique(Args &&... args) {
- return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
- }
- }
- //===----------------------------------------------------------------------===//
- // Main driver code.
- //===----------------------------------------------------------------------===//
- int main() {
- // Prime the first token.
- fprintf(stderr, "ready> ");
- getNextToken();
- // Run the main "interpreter loop" now.
- MainLoop();
- AstObjects::TheModule->dump();
- return 0;
- }
|