1 Star 0 Fork 1

zcy543814 / GoCompiler_antlr

forked from victayria77 / GoCompiler_antlr 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
app.java 909 Bytes
一键复制 编辑 原始数据 按行查看 历史
victayria77 提交于 2022-04-12 19:34 . version1
import java.io.IOException;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.tree.*;
public class app {
public static void main(String[] args) {
String fileName = "./examples/exprTest1.go";
GoParser parser = null;
try{
CharStream stream = CharStreams.fromFileName(fileName);
GoLexer lexer = new GoLexer(stream);
CommonTokenStream tokens = new CommonTokenStream(lexer);
parser = new GoParser(tokens);
} catch(IOException e){
e.printStackTrace();
}
ParseTree ast = parser.sourceFile();
VisitHandler_index visitor = new VisitHandler_index();
visitor.visit(ast);
// ParseTreeWalker walker = new ParseTreeWalker();
// ExpressionListenerHandler listener = new ExpressionListenerHandler();
// walker.walk(listener, ast);
}
}
Java
1
https://gitee.com/zcy543814/go-compiler_antlr.git
git@gitee.com:zcy543814/go-compiler_antlr.git
zcy543814
go-compiler_antlr
GoCompiler_antlr
phase1_simpleExpression

搜索帮助