This commit is contained in:
Wankupi
2023-10-30 19:34:40 +08:00
commit 2e29af68b3
107 changed files with 7880 additions and 0 deletions

20
src/main.cpp Normal file
View File

@ -0,0 +1,20 @@
#include "Evalvisitor.h"
#include "Python3Lexer.h"
#include "Python3Parser.h"
#include "antlr4-runtime.h"
#include <iostream>
using namespace antlr4;
// TODO: regenerating files in directory named "generated" is dangerous.
// if you really need to regenerate,please ask TA for help.
int main(int argc, const char *argv[]) {
// TODO: please don't modify the code below the construction of ifs if you want to use visitor mode
ANTLRInputStream input(std::cin);
Python3Lexer lexer(&input);
CommonTokenStream tokens(&lexer);
tokens.fill();
Python3Parser parser(&tokens);
tree::ParseTree *tree = parser.file_input();
EvalVisitor visitor;
visitor.visit(tree);
return 0;
}