[antlr-interest] automatically generated syntatic predicates become semantic predicates (fragments) plus arguments generate parser which doesn't compile

Doucette, Charles cdoucette at vaultus.com
Tue Sep 16 07:21:55 PDT 2008


Sorry - that was sent prematurely:

Here are my grammar options.
I don't completely understand what they mean.
I inherited them when I started with a Java grammar.

options {
        k=2;
        backtrack=true;
        memoize=true;
//      output=AST;
}

When I tried to remove them and use the default options - I did get many errors and warnings.
I guess I have to follow your suggested tutorial to remove backtracking?

I didn't explicitly use arguments and predicates. ANTLR automatically generated the predicates for me;
probably based on my grammar options above.

>
> > It's a user bug. Arguments and predicates don't mix. Use scopes
> > instead like this.
> >
> > rule a
> > scope {
> > int i;
> > }
> >    : (pred)=> y {$a::i = 3;}
> >    ;

Thanks,
Chuck


More information about the antlr-interest mailing list