Starting with ANTLR4 #4706
-
As we can now compile our ANTLR2 written code with Java 21, I'd like to do first steps with ANTLR4. I've installed ANTLR4 in my MacOS as the tutorial https://tomassetti.me/antlr-mega-tutorial/#setup-antlr explains it, created an alias for my bash etc. and it works:
When I now pick-up the first example from doc/getting-started.md it simply failes:
Perhaps I do something stupidly wrong. Please help me out. What is |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
You might want to skip the aliases and just type out the Java command completely to see what is going on. "TestRig" runs a compiled Java parser. For TestRig, you use the grammar name, not the grammar file name.
The alternative is to use the "easy" Python tool wrappers for Antlr4. In that case, after doing Note, the main issue with the Python wrapper tools for Antlr4 are timeouts. The tools try to download from "Maven Central", to get the latest version of Antlr, and then download that .jar file. But, it's been having problems lately. I just checked https://search.maven.org/solrsearch/select?q=a:antlr4-master+g:org.antlr where it goes to get the latest version of the .jar, but it times out. After it downloads the .jar and JRE, it places them in a cache directory |
Beta Was this translation helpful? Give feedback.
Actually, for the Python wrapper tools, just run the command
antlr4-parse
with-v 4.13.2
and it avoids the query to find the latest version of Antlr4. It'll still do a download, but there are two different addresses. One address is to get the latest version of Antlr4 athttps://search.maven.org/solrsearch/select?q=a:antlr4-master+g:org.antlr
(times out). The other address ishttps://repo1.maven.org/maven2/org/antlr/antlr4/
, which is old html support for FTP, and that always works. Just run the command with a version option and all works! No need to copy anything.