antlrworks2 error with left-recursive rules

99 views
Skip to first unread message

Thomas Schmid

unread,
May 29, 2015, 5:19:36 PM5/29/15
to antlr-di...@googlegroups.com
Hi,
today i encounterd a problem with antlrworks2 (ANTLRWorks 2 20130716-5d2e7d936ca1) . As soon as i add any left recursiv rule to the grammer the "Run in TestRig" fails.
For example this simple expression grammar fails:

grammar newEmptyCombinedGrammar;

expr
: expr ('*'|'/') expr
   
| expr ('+'|'-') expr
   
| '(' expr ')'
   
| INT
   
;

INT
: [0-9]+;

i get the following output in the "TestRig Window"

Compiling grammar files...
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.modules.PatchedPublicProcessor' less than -source '1.8'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.util.ServiceProviderProcessor' less than -source '1.8'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.util.NamedServiceProcessor' less than -source '1.8'
warning: Supported source version 'RELEASE_6' from annotation processor 'org.netbeans.modules.openide.util.NbBundleProcessor' less than -source '1.8'
4 warnings
Arguments: [newEmptyCombinedGrammar, expr, -tokens, -tree, -gui, C:\....\exp.txt]

and Antlrworks2 states that there is a unexpected Exception:

in detail:

java.lang.ClassNotFoundException: newEmptyCombinedGrammarParser
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at org.antlr.v4.runtime.misc.TestRig.process(TestRig.java:174)
    at org.antlr.v4.runtime.misc.TestRig.main(TestRig.java:143)
Caused: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
[catch] at org.antlr.works.editor.grammar.actions.RunInTestRigAction$TestRigTask.run(RunInTestRigAction.java:359)
    at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432)
    at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2042)
 

other grammers without left recursive rules compile just fine and the treegui/string tree/tokes show up as expected.
I googled the problem but haven't found any other similiar problems.
Maybe someone can help me with my problem.

Thomas

Frank Striegel

unread,
Apr 7, 2016, 5:03:41 AM4/7/16
to antlr-di...@googlegroups.com
I have the same problem. Any solution?

Michał Durecki

unread,
Jan 19, 2017, 10:17:56 AM1/19/17
to antlr-di...@googlegroups.com
Unfortunately I have the same problem. Did you find the solution?

Michał

Immanuel Stephen

unread,
Feb 2, 2017, 12:59:03 PM2/2/17
to antlr-discussion
For me running antlrworks 2 with java 8 caused this issue. I reverted to java 7 and it works
Reply all
Reply to author
Forward
0 new messages