[antlr-interest] A rule ANTLR 3 doesn't like [Re: ANTLR 3 diagnostics]

J Chapman Flack jflack at math.purdue.edu
Fri Dec 28 10:20:13 PST 2007


J Chapman Flack wrote:
> That sounds more promising, though I seem to recall trying it yesterday
> and still blowing the stack. I'll try with the newer build.

A new grammar containing only this rule in isolation compiles
without error (and generates believable code). In the original
grammar, the stack still overflows in the DFA builder while
working on this rule.  I suppose I can start copying other
rules over from the original until it blows up again; something
involving callers of the rule, I suppose.

Is there any other technique (after adding -Xwatchconversion)
that might shed some more light?  I'll try -Xdbgconversion
and see what I can make sense of.

What does -Xm do?  Might the converter invoke rules repeatedly?
(Ok, I'll order the book, it probably has more of that information
than I'm finding on the wiki).  Could that pose a problem for
rules where choices depend on parameters and sempreds?

-Chap

> numeric_aggregate[int n, int tt]
>                  @init {
>                    boolean limit = ( 0 != n );
>                  }
>                  : NUMBER
>                    ( options { greedy = true; } :
>                      { (!limit || (--n > 0)) && LA(1) == tt }? ~( SEMI )
>                      NUMBER
>                    )*
>                    { !limit || 0 == n }?
>                  ;
> 



More information about the antlr-interest mailing list