[antlr-interest] problem parsing a file

Rajesh Kumar bradkumar at gmail.com
Fri Jan 12 08:21:05 PST 2007


You are right. There is a lot of recursion going on. However, I am not
sure how to rewrite the treewalker class if I specify the grammar with
a * instead of recursively

Can you point me to a small example so that I'll know how to re-write
the trewalker if I change the grammar to use "*"

Thanks a lot for you help. Actually I am not an extensive user of
Antlr and I just wrote this parser a while back. Since it seemed to
work I did not bother with the muances :)

> The implication of the stack overflow error (to me - I could well be
> wrong) is that you've got a lot of recursion going on - i.e. there's a
> recursive rule that's reading a lot of the file in one go. It might
> not crash for 60k files because the stack's big enough, but 700k
> causes too many levels of recursion.
>
> Looking at the stack trace, the recursion would seem to be in the rule
> 'labelled_rule_list_entries' - implication is that you're parsing a
> list - could it be refactored to use a * or + rather than a recursive
> rule?
>
> Stuart Dootson
>


-- 
Rajesh Kumar
http://www.ece.cmu.edu/~rajeshk


More information about the antlr-interest mailing list