On Sat, Nov 26, 2011 at 9:58 AM, franck102 <franck...@yahoo.com> wrote:

> In fact the tree has been constructed by the leading (ID->ID),


That tree only exists inside your parenthesis, AFAIK. You can't reference
it outside it (well, you can, but it will be `null`).


So here is exactly what I am trying to do, there is probably a better way
> than what I have (untested pseudo-grammer, but you should get the idea):
>
> expr
>    :    ( prefix -> prefix ) ( suffix -> /* *insert prefix as first child
> of suffix and return suffix * */ ) *
>
> prefix : ID;
>
> suffix
>    :    DOT ID     -> ^( DOT ID )
>    |    '[' expr ']'  -> ^( INDEX expr )
>
> I guess I could use a scope to pass down the prefix; or have suffix return
> both the root type and a flat list and build the tree in expr; but both
> seem
> painful to get right typing wise...
>
>
Yes, it's a pain compared to simple passing the tree as a parameter, but
that's the "penalty" for turning on global backtracking [1].

Bart.


[1]
http://www.antlr.org/wiki/display/ANTLR3/How+to+remove+global+backtracking+from+your+grammar

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 il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to