I know this probably looks like a duplicate. It's not. I've searched for an hour, trying everything I've seen and nothing has worked.
I have an antlr4 grammar file called MathLang.g4
. I have put it into its own folder called Grammartest
. antlr-4.7.1-complete.jar
is in C:\Program Files\Java\libs
, along with antlr4.bat
and grun.bat
. The folder is in the PATH and the jar is in the CLASSPATH. The bat files read as such:
// antlr4.bat
java org.antlr.v4.Tool %*
// grun.bat
java org.antlr.v4.gui.TestRig %*
I then run the following commands in the Grammartest folder:
antlr4 MathLang.g4
javac MathLang*.java
grun MathLang def
antlr4
and javac
run silently, generating the .java
and then .class
files. grun
responds with Can't load MathLang as lexer or parser
.
How can I fix this?