1

I'm using antlr4 on mac os, I installed it following the getting started documentation on github https://github.com/antlr/antlr4/blob/master/doc/getting-started.md.

The testing works fine, but when enter any of these commands:

$ grun grammar rule –gui 
$ grun grammar rule –tree
$ grun grammar rule –tokens

It shows this error:

Exception in thread "main" java.nio.file.NoSuchFileException: –gui
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:116)
    at java.base/sun.nio.fs.UnixFileAttributeViews$Basic.readAttributes(UnixFileAttributeViews.java:55)
    at java.base/sun.nio.fs.UnixFileSystemProvider.readAttributes(UnixFileSystemProvider.java:145)
    at java.base/java.nio.file.Files.readAttributes(Files.java:1755)
    at java.base/java.nio.file.Files.size(Files.java:2369)
    at org.antlr.v4.runtime.CharStreams.fromPath(CharStreams.java:86)
    at org.antlr.v4.gui.TestRig.process(TestRig.java:162)
    at org.antlr.v4.gui.TestRig.main(TestRig.java:119)

What could be the problem?

fullon
  • 11
  • 1
  • 5

1 Answers1

0

Since I do not have enough reputation yet I will have to post an answer. Have you cd'ed to the correct directory where the gui file is, and run this code first?

$ antlr4 run.g4
$ javac run*.java

The Java file will not exist which would throw the NoSuchFileException since it was not compiled yet.

Another note could be that -tree is called first then gui. Have you tried running them in different order?

Lastly, I noticed that the testing in the repository has an "r" between the file and -tree or -gui. Have you tried that as well? I do not think it is anything wrong with your installation since you said that you tested it and it worked, so it must be something wrong with that Java file.