[antlr-interest] how to solve 'code too large' problem?

chintan chintanraoh at gmail.com
Fri Jul 13 09:10:32 PDT 2007


Hi,
I had this problem too.I had an unnecessary large 'k'. I decreased it
from 5 to 3. It solved my problem. 
Also try to make your grammar compact that might help. Take care that
antlr is not handling too many look aheads if in your rule there
decision point as to what path to take.

On Fri, 2007-07-13 at 16:36 +0200, Chaudhari, Pranita, OPEE14 wrote:
> Hello,
>  
> I am using Antlr V3 for writing grammar to parse UML Model (exported
> to XMI).For that I created individual token for each UML element, now
> the number of tokens are more than 150 and it creates large lexer java
> file. And   java compiler throws  following error:
>  
>                    xmiLexerLexer.java:7488: code too large
>                         public void mTokens( )  throws
> RecognitionException{
>  
> Is it possible to split the Lexer grammar file in to two  and import
> tokens from both files into Parser grammar file?
>  
> I also want to apply 'UML model design rules' on the parsed data and
> check whether the model is according to design rules or not. How can I
> write Antlr grammar for this in separate grammar file  and apply it to
> parsed XMI data.
>  
> Design rules can be like:
> -  Class names should start with a capital letter.
>  
>  
> -Thanks 
> Pranita



More information about the antlr-interest mailing list