antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
BSD 3-Clause "New" or "Revised" License
17.2k stars 3.29k forks source link

[Go Target] parsing java too slow #3279

Open paranoid1996 opened 3 years ago

paranoid1996 commented 3 years ago

I used IDEA plugin to compile Java8Parser.g4 and Java8Lexer.g4 in go target. I want to parse jave in go,and my code like this:

lexer := parser.NewJava8Lexer(antlr.NewInputStream(content)) tokens := antlr.NewCommonTokenStream(lexer,0) java8Parser := parser.NewJava8Parser(tokens) tree := java8Parser.CompilationUnit() typeListener := listener.NewJavaFileTypeListener() walker := antlr.ParseTreeWalker{} walker.Walk(typeListener, tree)

but this line tree := java8Parser.CompilationUnit() runs too slow, I dont know why

KvanTTT commented 3 years ago

Duplicate. See https://github.com/antlr/antlr4/pull/3243, https://github.com/antlr/antlr4/issues/2152, and other related issues.