[antlr-interest] Re: urgent problem with stack overflow, please help

netminka netminka at netscape.net
Fri Oct 10 11:36:43 PDT 2003


The problem is not with the size of the input text, just the 
procedures. If I split the procedures up, same code otherwise,
no stack overflow. 

> Did you track the resource usage for your parser?. 
> If you have a basic version of the grammar without embedded action
> code, does it still report the same error?

I will try this, thanks.
megan 


--- In antlr-interest at yahoogroups.com, "micheal_jor" <open.zone at v...> 
wrote:
> --- In antlr-interest at yahoogroups.com, "netminka" <netminka at n...> 
wrote:
> > hi all,
> > I am writing a commercial grade translator. The source language
> > environment has tools which generate large initialization 
> > procedures, I have seen up to 1100 lines. This causes stack 
overflow.
> > We are using C# antlr. Stack overflow happens at about 600 lines.
> > This happens in the first stage of parsing, not the tree parser.
> 
> I am not sure what problem it is you are describing here Megan. 
ANTLR
> generated parsers (in Java, C++ and C#) can trivially process input
> text that contains procedures/methods in excess of the 1-2K lines 
you
> mentioned.
> 
> Running the lexer/parser for the ANTLR Java grammar on the
> ANTLR-generated lexer for the Java grammar is one way to convince 
your
> self that ANTLR C# can handle long procedures.
> 
> > The other odd thing about this is that the large procedures 
> > consist of assignment statements, one per line. That's it.
> > No big expressions. The overflow is related strictly to the 
> > number of lines in a procedure, not the complexity of the 
> > expressions or anything else. The stack, as it is related to the
> > grammar definition, is not growing with the size of the 
procedure. 
> > I know the grammar rules are closing properly because I have run
> > a great deal of code through this translator and I am intimately
> > familiar with the parse traces. This makes me think that there
> > may be a basic clean-up problem happening here..? 
> 
> Did you track the resource usage for your parser?. 
> If you have a basic version of the grammar without embedded action
> code, does it still report the same error?
> 
> > Can anyone out there who is using antlr java or C++ comment on 
> > stack overflow problems for large source.  Is there one 
> > implementation platform that is better, do they all have this
> > problem? Is this a .Net memory management problem? Comments
> > appreciated!
> 
> Some of my input source files have been greater than 1MB with ANTLR
> C#/Java/C++ generated lexers/parsers. Incidentally, 1MB isn't some
> some of limit, I just mentioned that because I have fed files of 
that
> size to C# parsers successfully. And the parsers built the AST 
without
> any issues.
> 
> Actually, if memory serves, the system parsed the 1MB+ files (they
> were about a dozen in the set) and lots of other source files (read
> hundreds) and stitched their ASTs together into a single forest.
> 
> Cheers,
> 
> Micheal


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list