init
This commit is contained in:
1
src/Evalvisitor.cpp
Normal file
1
src/Evalvisitor.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include "Evalvisitor.h"
|
14
src/Evalvisitor.h
Normal file
14
src/Evalvisitor.h
Normal 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
20
src/main.cpp
Normal 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;
|
||||
}
|
Reference in New Issue
Block a user