Boost logo

Proto :

Subject: Re: [proto] Thoughts on traversing proto expressions and reusing grammar
From: joel falcou (joel.falcou_at_[hidden])
Date: 2010-10-15 04:23:10


On 15/10/10 09:22, Eric Niebler wrote:
> Goodness Joel, I have no idea what you're asking. What's the "visitor
> level"? Why would you have to transform the AST? What are you trying to
> do, exactly?
>
LOL, please excuse my non-caeffinated post at 8am :€

I have some AST that represent arithmetic computation.
I know that when I encouter a "a + b*c" node (where a,b,c can be expression
themselves), I can evaluate it using an optimised call instead
of chaining + and *.

Currently I do this by transforming my AST into another where a+b*c
is replaced by madd(a,b,c). Now, with your specialization of dispatch using
grammar instead of tag, I can check for a+b*c and dispacth to a special
trasnform
instead of having a bloated trasnform next to that.


Proto list run by eric at boostpro.com