[antlr-interest] Problems debugging large grammar in ANTLRWorks

Jim Idle jimi at temporal-wave.com
Fri Jun 1 12:17:01 PDT 2007


Debugging with ANTLRworks and the C target is not supported - I am not
sure if will do this any time soon, as the socket stuff and the way the
debug thing works does not lend itself well to doing certain things from
C. I think I saw that it serializes classes at some point and gave up
for now. 

It looks like your grammar exceeds the code generation limits for Java,
it isn't anything to do with ANTLR per se. Why java should have such a
thing, is a fair question, but it does. As for the memory question, well
Ter has said in the past that he may not be freeing up some object
references, but I don't know how true this is as of today. It seems to
me that Java just requires a lot of memory to print hello world and
isn't very good at reclaiming anything. I think the whole garbage
collection thing is a flawed idea from the start, but there are some
dilemmas if Java did not use this.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of troy runkel
> Sent: Friday, June 01, 2007 11:32 AM
> To: ANTLR mail-list
> Subject: [antlr-interest] Problems debugging large grammar in
> ANTLRWorks
> 
> Greetings,
> 
> I'm working with a fairly large grammar (1620 lines) and was hoping to
> debug it using ANTLRWorks 1.0.1.  When I select the 'Debug...' option
> from the Debugger menu I get the following error message popup.  My
> grammar is using the language=C option.
> 
>      Error while generating the grammar:
>      (10): internal error: group CDbg line 33: template outputFile has
> no region called imports
> 
> This looks like a problem with the C code generator so I commented out
> the language=C option line and tried again.  After that I get the
> following error message in the Console window.
> 
>      [12:22:02] \tmp\antlrworks\TSQLParser.java:20: code too large
>      [12:22:02]     public static final String[] tokenNames = new
> String[] {
>      [12:22:02]                                  ^
>      [12:22:02] 1 error
> 
> It looks like maybe there are too many token strings in the tokenNames
> array?  Does anybody have any advice on what I need to do to get my
> grammar working with the ANTLRWorks debugger?
> 
> I also noticed that after processing the grammar ANTLRWorks is
> consuming over 900MB of memory on my Windows XP desktop machine.  If I
> avoid ANTLRWorks and process the grammar directly with ANTLR I get up
> to around 600MB of memory.  Is this normal?  Does that mean there's an
> upper bound to the size of the grammar that ANTLR can process?  I've
> been running java with the -Xmx1490m option to avoid running out of
> java heap space.
> 
> In addition to the language=C option I'm also using backtrack=true and
> memoize=true.
> 
> Thanks.
> 
> Troy Runkel


More information about the antlr-interest mailing list