[antlr-interest] Antlr 3.2 issues: code too large and "no such attribute: description"

Edson Tirelli tirelli at post.com
Tue Aug 17 17:49:08 PDT 2010


   Hi Jim,

   Thanks for the reply. Lets simplify things and forget antlrworks and the
code too large for now. The most important for me is to be able to compile
the grammar with -debug on the command line.

   On the command line, I am using the following:

$ java -classpath
"antlr-3.2.jar;antlr-runtime-3.2.jar;antlr-2.7.7.jar;stringtemplate-3.2.1.jar"
org.antlr.Tool -debug -lib src/lang src/lang/DRL.g

     I get the error:

    [java] error(10):  internal error:
src/main/resources/org/drools/lang/DRL.g : java.util.NoSuchElementException:
no such attribute: description in template context [orPredicates
notPredicate evalPredicate(...)]

   That seems the same problem reported in
http://www.antlr.org/jira/browse/ANTLR-378 .

   My grammar is here:
http://anonsvn.jboss.org/repos/labs/labs/jbossrules/branches/etirelli/drools-compiler/src/main/resources/org/drools/lang/DRL.g

   As I mentioned before, it is fairly complex. Also, there is a ton of code
in there to support the code editor, what "polutes" the grammar, so I don't
expect anyone to understand it. The important thing is it does compile
without any warnings or errors, except for when I try to use the -debug
flag.

   Thanks

   Edson

2010/8/17 Jim Idle <jimi at temporal-wave.com>

> The JIRA you quote is not showing the same problems as the error you quote,
> hence the patch is unlikely to help. If your grammar is too large with the
> debug stuff in it then it is possible that its structure is not so good. It
> is also possible that it is just too big for a single file of course. As
> you
> say, you can debug at the java level too - the multiple grammar debugging
> stuff in ANTLRWorks does not seem to be quite there.
>
> Are you using the latest jar download to generate at the command line and
> not the ANTLR that is embedded in ANTLRWorks? You should really supply the
> invocations you are using as otherwise we have to guess. You could try
> generating using the ANTLRWorks jar. However, if the code is too big with
> debug stuff in it, then there isn't much you can do but start using
> imports.
> Also, try increasing the conversion timeout.
>
> Jim
>
>
>
> > -----Original Message-----
> > From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> > bounces at antlr.org] On Behalf Of Edson Tirelli
> > Sent: Tuesday, August 17, 2010 2:11 PM
> > To: antlr-interest at antlr.org
> > Subject: [antlr-interest] Antlr 3.2 issues: code too large and "no such
> > attribute: description"
> >
> >    Hey all,
> >
> >    Need some advice. Question:
> >
> > * short version: Does anyone tried applying the patch from this ticket (
> > http://www.antlr.org/jira/browse/ANTLR-378) on ANTLR 3.2? Is it still
> good?
> >
> > * long version:
> >
> >    I am adding support for full Java expressions to Drools
> (www.drools.org)
> > DRL language, and basically my grammar (that was already complex) now is
> > also twice the size it was. Before, I was using ANTLRWorks (1.4) to debug
> my
> > grammar but now, when I try to debug I get the error:
> >
> > "code too large"
> >
> >    That is a bit strange to me as the grammar generates just fine when I
> use
> > the command line tool to generate it, but I figured it might be due to
> some
> > additional code ANTLRWorks might be generating for debug purposes. My
> > search through this list archives and internet found some comments
> stating
> > that the way to go in this case would be to use Composite Grammars, but
> the
> > problem seems to be that neither antlrworks nor the eclipse plugin have
> > proper support to it. I gave it a quick try and it does highlight missing
> rules as
> > errors in dependent grammars making maintenance a lot harder.
> >
> >     So, if I would have to do remote debugging anyway, I tried to do it
> with my
> > current grammar. Although, when I try to generate the grammar with the "-
> > debug" flag on the command line, I get:
> >
> >     "[java] error(10):  internal error:
> > src/main/resources/org/drools/lang/DRL.g :
> > java.util.NoSuchElementException:
> > no such attribute: description in template context [orPredicates
> notPredicate
> > evalPredicate(...)]"
> >
> >     This is apparently a known bug reported since ANTLR 3.1.1 (
> > http://www.antlr.org/jira/browse/ANTLR-378) for which a patch was
> > provided but apparently never applied.
> >
> >     Right now I am stuck, since I can not debug neither locally nor
> remotely, I
> > see only two options: either I go trial and error working on my grammar
> > (what can be extremely time consuming for a complex grammar like
> > ours) or I try to apply the patch and build my own StringTemplate/ANTLR
> > binaries and hope that it will work.
> >
> >     So, before spending more time on the later, I wanted to check if
> anyone
> > else tried that and succeeded, otherwise, I will just go the old way and
> debug
> > the generated code itself. :(
> >
> >     Anyone worked around these problems yet? Any advice?
> >
> >     Thanks a lot,
> >        Edson
> >
> > --
> >   Edson Tirelli
> >   JBoss Drools Core Development
> >   JBoss by Red Hat @ www.jboss.com
> >
> > List: http://www.antlr.org/mailman/listinfo/antlr-interest
> > Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> > email-address
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>



-- 
  Edson Tirelli
  JBoss Drools Core Development
  JBoss by Red Hat @ www.jboss.com


More information about the antlr-interest mailing list