« Return to Thread: Bytecode Generation

Re: Bytecode Generation

by Matt Fowles :: Rate this Message:

Reply to Author | View in Thread

Arno~

I definitely find the visitor pattern to be a mixed blessing.  It has
a lot of advantages, but it does introduce a great deal of complexity
into code.  I suppose all things have trade offs...

Matt

On Wed, Jun 18, 2008 at 5:00 PM, Arno Unkrig <arno@...> wrote:

> Matt Fowles schrieb:
>>
>> Arno~
>>
>> On Sat, Jun 14, 2008 at 5:54 PM, Arno Unkrig <arno@...> wrote:
>>>
>>> Matt Fowles schrieb:
>>>>
>>>> All~
>>>>
>>> ...
>>>>
>>>> went very smoothly.  I was a little surprised to discover that Janino
>>>> requires its AST to actually be a tree.  Our internal stuff allows for
>>>> sub-expression reuse with in the tree.  But emitting a tree was a
>>>
>>> That's because compile-time status information is stored in the AST.
>>> Surely
>>> a design flaw, but really difficult to resolve without splitting up all
>>> the
>>> AST classes and ending up with twice the number of classes, and a lot of
>>> glue code.
>>
>> Yes, I figured that out.  I agree with you that it might be a flaw,
>> but the flip side is the extra classes you mentioned.  I am not sure
>> either what the "correct" design is.  Although I have noticed that
>> compilers tend to be complicated beasts...
>>
>> Matt
>
> Yep, exactly. And one big design goal of JANINO is simplicity. I hate
> structures being duplicated...
>
> BTW, this issue is a bit of a shame: In ancient versions, the AST nodes all
> had "compile()" and "getType()" methods. Then, one day, I decided to switch
> to the VISITOR pattern to get the compilation logic out of the AST classes.
> When I was finished, I couldn't find a reasonable way to get the compile
> time state information out of the AST nodes. In retrospect, maybe I'd better
> left ALL the compilation logic inside the AST.
>
> But the VISITOR pattern functions prettily for UnparseVisitor and stuff, so
> the refactoring was not a complete mess.
>
>
> CU
>
> Arno
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>   http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Bytecode Generation