golex | github.com/cznic/golex has moved to modernc.org/golex
kandi X-RAY | golex Summary
kandi X-RAY | golex Summary
github.com/cznic/golex has moved to modernc.org/golex (vcs). Please update your import paths to modernc.org/golex. This repo is now archived.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of golex
golex Key Features
golex Examples and Code Snippets
Community Discussions
Trending Discussions on golex
QUESTION
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:
...ANSWER
Answered 2021-Jul-08 at 13:09You should also include GoParserBase.java.
The fact that the parser extends a base class is because inside the parser rules there are a couple of predicates (look for {noTerminatorAfterParams(int)}?
, and other {...}? occurences
). This is target specific code and the author(s) decided not to include this code inside the grammar (besides the invocation of the method, of course), but separate it from the grammar.
It also makes it easier to integrate within the grammars-v4
repository, but this will only make sense to you if you know how the grammars-v4
repository is setup and how unit tests run.
If you don't want to extend the base parser, you could also do this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install golex
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page