[antlr-interest] "code too large" / can't split AST output into smaller files

Andreas Stefik stefika at gmail.com
Fri Oct 8 08:41:29 PDT 2010


Hi Stephen,

Can you post the exact compiler error? I also run my grammar in
NetBeans 6.9.1, generated from antlrworks 1.4, but don't have any such
problems. My generated parser is a bit smaller than yours though
(about 8k lines), although it isn't immediately obvious to me why that
would matter.

Stefik

On Fri, Oct 8, 2010 at 8:44 AM, Stephen Winnall <steve at winnall.ch> wrote:
> I'm using Antlr 3.2 with Java 1.6.0_20 under Mac OS X 10.6.4.
>
> I have a composite grammar which generates AST trees. I can run and debug the grammar from AntlrWorks 1.4 without any problem.
>
> However, my grammar is part of a larger project, which I am developing with NetBeans 6.9.1 and Maven, using the antlr3-maven-plugin. When I try to build my project, the grammar file gets translated into Java alright, but the resultant Java parser file causes a "code too large" error.
>
> I don't understand why AntlrWorks can compile the grammar but NetBeans cannot. Can anyone enlighten me? The generated parser file is 13756 lines long and the "code too large" error under NetBeans appears on line 7204, so there seems to be a fundamental difference in what NetBeans/Maven and AntlrWorks are doing.
>
> I have tried to split the grammar into smaller bits to work round this problem. I took some parser rules and put them into a different parser grammar, which I imported into the main one. However, nearly all my parser rules include "-> ^( ... )" to generate AST stuff. Antlr complains when it sees a "^(" in the imported file. I have included "output=AST;" in the options for the imported file.
>
> None of the examples of composite grammars that I have been able to find in the net deal with AST output from the imported file. Is there some trick I should be aware of?
>
> Regards
> Steve
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list