0
votes

I have used ANTLR to parse Java code and everything works well. But the problem is getting the following error when I run it in on a Mac:

javac -cp antlrworks-1-1.4.3.jar *.java
Main.java:18: cannot find symbol
symbol  : method javaSource()
location: class JavaParser
        CommonTree tree = (CommonTree)parser.javaSource().getTree();
                                            ^
1 error
1

1 Answers

1
votes

The Java grammar you are using does not have a rule called javaSource, so no method with that name exists in the generated code. Some other Java grammars I have seen use compilationUnit, but without seeing your grammar there's no way to tell you exactly how to fix this.