Reputation: 91
I am using ANTLR 4.4 with Python3 as target language. You can see in this page: https://github.com/antlr/antlr4/releases that ANTLR 4.4 suppors Python3 but when I want to create a Python lexer & parser with this command: -Dlanguage=Python3 MyGrammar.g4 , I got this error:
ANTLR cannot generate python3 code as of version 4.4
I don't know it is because of my grammar and I have to modify it to resolve this error or waht?(BTW I got no error in ANTLRWorks 2.1) Any help would be appreciated.
Upvotes: 2
Views: 3999
Reputation: 330
$ antlr4 -Dlanguage=python3 grammar.g4
error(31): ANTLR cannot generate python3 code as of version 4.11.1
$ antlr4 -Dlanguage=Python3 grammar.g4
Upvotes: 0
Reputation: 2248
As mentioned here https://theantlrguy.atlassian.net/wiki/display/ANTLR4/Python+Target :
Upvotes: 5
Reputation: 91
The error is removed by change the definition of CLASSPATH. First I specified it permanently: Using System Properties dialog > Environment variables > Create or append to CLASSPATH variable
then I changed it to temporary as follows: SET CLASSPATH=.;C:\Javalib\antlr-4.4-complete.jar;%CLASSPATH% and the error disappeared.
Upvotes: 0