when i try to generate the listener/visitor ... for my Grammar I get the following error : ANTLR cannot generate Javascript code as of version 4.5
Does anybody knows how to fix it? I still can generate C# and Java Code.
I was working with ATNLR to parse hive queries in java and had a similar issue. It turns out that I was missing the case. Instead of Java I was writing java
$>antlr -Dlanguage=java Hplsql.g4
-->error(31): ANTLR cannot generate java code as of version 4.7.1
$>antlr -Dlanguage=Java Hplsql.g4
-->Success
From the docs:
This is pretty much the same as creating a Java lexer or parser, except you need to specify the language target, for example:
$ antlr4 -Dlanguage=JavaScript MyGrammar.g4
For a full list of antlr4 tool options, please visit the tool documentation page.
It is possible that you are targeting Javascript
instead of the required JavaScript
(note the case); observe the difference when I execute the two:
╭─{ yaauie@celeborn:~/Desktop/tmp-20160108 }
╰─○ antlr4 -Dlanguage=JavaScript Hello.g4
[success]
╭─{ yaauie@celeborn:~/Desktop/tmp-20160108 }
╰─○ antlr4 -Dlanguage=Javascript Hello.g4
error(31): ANTLR cannot generate Javascript code as of version 4.5.1
[error: 1]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With