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

Edson Tirelli tirelli at post.com
Tue Aug 17 14:11:20 PDT 2010


   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


More information about the antlr-interest mailing list