On Fri, Oct 15, 2010 at 1:23 AM, joel falcou <joel.fal...@lri.fr> wrote:
> 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
> instead of having a bloated trasnform next to that.
Joel, I think I still must be missing something. You also have an extensible
grammar w/ pluggable transforms, is that right? Then if I understand your
requirements, then I think the answer is yes, you can dispatch to the
appropriate transform based on the grammar for "a+b*c". But it's hard to say
without knowing a little more.
proto mailing list