I'm trying to create a javascript parser in golang using antlr4. the grammar I'm using is this one (https://github.com/antlr/grammars-v4/tree/master/javascript/ecmascript) and I'm following instructions from this readme https://github.com/antlr/antlr4/blob/master/doc/go-target.md
so I've generated the lexer and parser files from the grammar, and I'm trying to test parsing a program.
func Parse(program string) {
is := antlr.NewInputStream(program)
lexer := parser.NewECMAScriptLexer(is)
stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel)
p := parser.NewECMAScriptParser(stream)
antlr.ParseTreeWalkerDefault.Walk(&ParserListener{}, tree)
}
the problem is antlr.ParseTreeWalkerDefault.Walk
expect a parser listener and a tree. but BaseParser has no function to generate a tree type object. https://godoc.org/github.com/antlr/antlr4/runtime/Go/antlr#BaseParser