someRule
    : a PLUS b
        -> { areStrings($a.tree,$b.tree) } ^(CONCATENATE a b)
        -> ^(PLUS a b)

On Thu, 2009-05-14 at 23:38 -0400, David Jameson wrote:
> Is there any way to control the built-in tree generation (from an  
> initial parse phase) based on semantics of what is being parsed?
> 
> As a simple example,    if   I see the expression
>         a + b
> 
> then I want to produce
>      (PLUS a b)
> or
>     (CONCATENATE a b)
> 
> depending on whether a and b are numeric or string.
> 
> 
> How can I do this with rewrite rules (for example)?   Or do I have to  
> construct my own trees?
> 
> 
> Thanks,
> D
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
-- 
Steve Ebersole <[email protected]>
Hibernate.org


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