On Nov 30, 2008, at 1:07 PM, Oliver Zeigermann wrote:

> OK. I do not quite grok it. Looking at
>
> topdown
>    :   ^('*' INT ^(VEC (e+=.)+)) -> ^(VEC ^('*' INT $e)+)
>    ;
>
> bottomup
>    :  ^('*' a=. b=INT {$b.int==0}?) -> $b // x*0 -> 0
>    ;
>
> Why has the second to be in bottomup?

x*(4*0)

If you do it top down, you won't see x*0, you'll see only x*(4*0).   
You will rplace 4*0 with 0, but then you won't see x*0.  You need to  
do it innnermost (bottomup) not outermost (topdown) to see all  
opportunities.

You need to do

4*0 -> 0
x*0 -> 0

not

4*0 -> 0

and stop.

Ter

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/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