I need some guidance parsing a '.drl' AKA a Drools Rule File. A drl file is defined by ANTLR3 grammar which can be found here. I have previously worked with g4 grammar using ANTLR v4 grammar plugin for IntelliJ , I could easily generate i) Parse tree for a sample file AND ii) A visitor.java file for that particular grammar.
I need to generate the above two for ANTLR3 as well, i.e i) Parse Tree for Sample.drl file ii) A visitor.java file for DroolsRule.g which can take in Sample.java as input for parsing.
I have attempted to generate a .dot file for an AST by following steps for Bart Kiers answer to this question. But while attempting to generate lexers and parsers in step 1 as mentioned like
java -cp antlr-3.3.jar org.antlr.Tool Java.g
I get the following error
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: antlr/ANTLRException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: antlr.ANTLRException
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
Also, i could not find if it is possible to generate a visitor.java. like function for DroolsRule.g using ANTLR3.