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

J Chapman Flack jflack at math.purdue.edu
Fri Dec 28 07:46:39 PST 2007


Terence Parr wrote:
> Hi Chap, try removing side effects from preds...no telling how many 
> times they exec now.

Good to know, I'll be sure to take out the side effects. But I trust
ANTLR isn't trying to analyze the java code, so this can't be behind
the stack overflow in the DFA builder, right?

> Also use {...}?=> pred not {..}? to force including in DFA decision maker.

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

-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