porting from ANTLR2 to ANTLR4 #4787
gurucubano
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
With the help of GitHub Copilot I ported the grammar file InfoGuideQuery.g to InfoGuideQuery.g4. Also the Java code is changed accorgingly, compiles and runs with ANTLR4. I'm attaching the InfoGuideQuery.g4 here. What I do not understand is this detail:
The AST in ANTLR2 looks like this:
The output of the tool `antlr4-parse´ as well from the Java code gives this:
The Java code from
src/main/java/org/oclc/test/GrammarTests.java
(attached tooInfoGuideQuery.g4.txt
GrammarTests.java.txt
) produces something similar:
At least consistent. But, why are the words like
info_guide_query_atom
from the grammar fileInfoGuideQuery.g4
are part of the output?Beta Was this translation helpful? Give feedback.
All reactions