On 4 May 2013 12:21, Clément Bera <bera.clem...@gmail.com> wrote:
> 2013/5/4 stephane ducasse <stephane.duca...@free.fr>
>>
>>
>> On May 4, 2013, at 1:04 AM, Igor Stasenko <siguc...@gmail.com> wrote:
>>
>> > Did i said already that i don't like how ASTInterpreter implemented? :)
>>
>>
>> We will let perfection for later :)
>
>
> It is not a question of perfection or so.
>
> Igor does not like that we interpret recursively the AST instead of with a
> loop (ASTInterpreter>>interpret: calls itself again and again). He would
> like to have a flatten-AST-interpreter, with a loop like:
>
> [currentASTNode hasNextNode] whileTrue: [ self interpret: currentASTNode
> nextNode ].

more precisely , something like:

| node |
node := self initialASTNode.

 [node notNil ] whileTrue: [ node := self interpretSingleASTNode: node ].


>
>  But Camillo and I don't want that because it interprets a flatten AST, not
> a tree.
>

Clement, it is not a question of "liking", it is question of how far
you can go with it.
With current implementation, if you try to interpret 10000 factorial,
you will crash the image with stack overflow.
And it is not about flattening a tree. Your input is always tree.
The only difference is how you walk over it, and what (or how many)
state you should keep while doing so.

But please, do not take me wrong: having AST Interpreter even in
current state is a big progress.

-- 
Best regards,
Igor Stasenko.

Reply via email to