Hi,

I've started using antlr a few days ago, so let me begin by thanking
everyone that contributed for creating this fantastic project.

Unfortunately, I think I ran into a bug and I'm hoping you might help me.

I'm using a tree grammar where I have the following rule:

expr returns [Expr value]
   | ID                                                { $value = new
Var($ID.text); }
   | ^(APP fn=expr (args+=expr)+ { $value = new App($fn.value, $args); }
   ...

Surprisingly, $args is a list of CommonTrees, and not a list of Expr
as I was hoping it would be. Is this a bug or a feature? If it's the
latter, is there any way to "convert" the tree into an Expr?

For now, I'm collecting args manually, with the following workaround:

expr returns [Expr value]
@init {
 List<Expr> ops = new ArrayList<Expr>();
}
   | ^(APP fn=expr (op=expr { ops.add($op.value); })+) { ... }
   | ID
                   { ... }

Thanks!

Luís Pureza

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.


Reply via email to