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

1
src/Evalvisitor.cpp Normal file
View File

@ -0,0 +1 @@
#include "Evalvisitor.h"

14
src/Evalvisitor.h Normal file
View File

@ -0,0 +1,14 @@
#pragma once
#ifndef PYTHON_INTERPRETER_EVALVISITOR_H
#define PYTHON_INTERPRETER_EVALVISITOR_H
#include "Python3ParserBaseVisitor.h"
class EvalVisitor : public Python3ParserBaseVisitor {
// TODO: override all methods of Python3ParserBaseVisitor
};
#endif//PYTHON_INTERPRETER_EVALVISITOR_H

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;
}