I am a beginner in both java and ANTLR. I am trying to use ANTLR in Netbeans IDE. I was trying to run a sample example and did follow all the important steps required like setting the environment variable, including jar file and modifying built.xml.
But when I try to clean and build my application I get following errors:
Error: Could not find or load main class org.antlr.Tool
Java Result: 1
Created dir: ../NetBeansProjects/AntlrTestApp/build/empty
Created dir: ../NetBeansProjects/AntlrTestApp/build/generated-sources/ap-source-output
Compiling 1 source file to ../NetBeansProjects/AntlrTestApp/build/classes
../NetBeansProjects/AntlrTestApp/src/antlrtestapp/AntlrTestApp.java:24: error: cannot find symbol
grammarLexer lexer = new grammarLexer(input);
symbol: class grammarLexer
location: class AntlrTestApp
../NetBeansProjects/AntlrTestApp/src/antlrtestapp/AntlrTestApp.java:24: error: cannot find symbol
grammarLexer lexer = new grammarLexer(input);
symbol: class grammarLexer
location: class AntlrTestApp
../NetBeansProjects/AntlrTestApp/src/antlrtestapp/AntlrTestApp.java:26: error: cannot find symbol
grammarParser parser = new grammarParser(tokens);
symbol: class grammarParser
location: class AntlrTestApp
../NetBeansProjects/AntlrTestApp/src/antlrtestapp/AntlrTestApp.java:26: error: cannot find symbol
grammarParser parser = new grammarParser(tokens);
symbol: class grammarParser
location: class AntlrTestApp
../NetBeansProjects/AntlrTestApp/src/antlrtestapp/AntlrTestApp.java:29: error: cannot find symbol
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
symbol: class Main
location: class AntlrTestApp
../NetBeansProjects/AntlrTestApp/src/antlrtestapp/AntlrTestApp.java:31: error: cannot find symbol
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
symbol: class Main
location: class AntlrTestApp
6 errors
../NetBeansProjects/AntlrTestApp/nbproject/build-impl.xml:603: The following error occurred while executing this line:
../NetBeansProjects/AntlrTestApp/nbproject/build-impl.xml:244: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 1 second)
I have been trying this since last 2-3 days and searched for all possible solutions but nothing worked for me.
It looks like you're trying to automatically generate a parser from an ANTLR 3 grammar during an Ant build. The following Ant script shows an example of this that includes the following features:
.g
files in the specified source folders, so you don't have to edit the build every time you add a grammar.https://github.com/antlr/antlr4/blob/master/build.xml
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