I'm trying to build an AST for a go file using antlr/grun.
I've taken the GoLexer.g4
and GoParser.g4
from here.
When compiling, javac
complains about now knowing GoParserBase
. That class is not defined in the source code generated by antlr.
It appears the workflow is slightly different from that of a single grammar file like in the official doc.
Which steps are missing?
These are the commands to reproduce the error from the grammars mentioned above:
$ antlr4 -no-visitor GoLexer.g4 GoParser.g4
$ javac -cp ".:/usr/share/java/antlr-complete.jar" -g *.java
GoParser.java:12: error: cannot find symbol
public class GoParser extends GoParserBase {
^
symbol: class GoParserBase
# and lots more errors
EDIT: Thanks for the solution, @bart-kiers.
For completeness, here is the grun call:
grun Go sourceFile -gui $GOPATH/src/encoding/json/encode.go