[antlr-interest] ANTLRv3 emits literal DOWN instead of Token.Down

Kalen Petersen khp at cypress.com
Tue Dec 4 10:01:50 PST 2007


Gavin Lambert wrote:
> At 14:53 4/12/2007, Kalen Petersen wrote:
> [...]
> >grammar DownBug;
> >   
> >bug_rule
> >    :   ^('+' bug_rule)
> >    |   '+' bug_rule
> >    |   ZERO
> >    ;
>
> Hmm.  I'm surprised that even compiles.  That doesn't seem like a 
> valid construct to me -- you're using ^ like an AST node (which 
> shouldn't work outside a rewrite rule or tree parser).
This came originally from a rewrite grammar working on an AST, it's 
true.  In the process of removing gobs of extraneous other code, I also 
removed those options.  Originally, it was actually two rules from an 
expression grammar, one for postfix '++' and the other for prefix '++'.
Hopefully that justifies this as a little less crazy or just invalid code.



More information about the antlr-interest mailing list