On Sat, 2011-01-29 at 09:34 -0800, Alan D. Cabrera wrote:
> functioncall
>     : varOrExp nameAndArgs+ -> ^(FUNCALL varOrExp nameAndArgs+)
>     ;
> 
> generates
> 
> (FUNCALL 
>       varOrExp
>       nameAndArgs1
>       nameAndArgs2
>       nameAndArgs3
> )
> 
> What I need it to do is generate
> 
> (FUNCALL 
>       (FUNCALL
>               (FUNCALL
>                       varOrExp
>                       nameAndArgs1)
>               nameAndArgs2)
>       nameAndArgs3)
> )
> 
> 
> I would appreciate any pointers on how I would go about generating this 
> nested structure.
> 

I have Curried a function application by passing the partial tree to
dependent rules. (Note: I strongly suspect that my solution is really
way more complicated than it needs to be, sorry about that...).

Something like:

functioncall
    : ( varOrExp nameAndArgs -> ^(FUNCALL varOrExp nameAndArgs) )
      ( curried_call[$functioncall.tree] -> curried_call )?
    ;

curried_call [ CommonTree t ] :
      (apply[t] -> apply) ( curried_call[$apply.tree] -> curried_call )?
   ;

apply [ CommonTree t ] : nameAndArgs -> ^(FUNCALL {$t} nameAndArgs) ;

Hope this helps....
   -jbb



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