Compiling sample ANTRL4 output

后端 未结 2 1517
别跟我提以往
别跟我提以往 2020-12-11 19:55

From the Definitive ANTLR4 reference I have run through the first example and it has generated the JAVA target. In the directory C:\\JavaLib I have antlr-4.5-complete.jar Wh

相关标签:
2条回答
  • 2020-12-11 20:15

    There was 2 problems. One was the file has to be named "Hello.g4" not "hello.g4" because the grammar is specified as Hello. The second was the classpath, it requires the path and name of the jar file, as well as the current directory. The following command worked;

    javac -classpath .;C:\JavaLib\antlr-4.5-complete.jar *.java
    
    0 讨论(0)
  • 2020-12-11 20:18

    With regard to the above query re the colon separator then the answer is yes. I installed via the debian packages and used the command before working out how to set CLASSPATH

    javac -classpath /usr/share/java/antlr4-runtime.jar  Expr*.java
    

    Before this I got a load of compile errors. Also it seems to be worth noting on debian at the moment my .bash_profile never gets loaded so I needed to put this in .bashrc

    0 讨论(0)
提交回复
热议问题