2008/1/23, Charles Oliver Nutter <[EMAIL PROTECTED]>:
> Yeah, I'd like to hear what others on this list think about this model.
> As I understand it (and I may have heard wrong), most of the "big" DLR
> languages currently don't generate straight up DLR trees, or they
> partially generate such trees but have to go outside the available
> structure quite a bit. From discussions on the IronRuby list, it also
> sounds like they're adding many permutations of different types of logic
> into individual tree node types:

Well, all DLR languages generate straigt DLR trees. DLR tree nodes are
usually generated from language-specific AST nodes, which certainly
contains many different logics.

> """
> 293085: (tomat) Fixes RubyForge bug #14425.
>
> Ruby allows jump statements (return, redo, retry, break and next) to
> appear in Boolean expressions as right operands.
>
> Examples:
>
> def foo x
>    x and return 'true'
>    x or return 'false'
>    'Unreachable'
> end
>
> foo true               # "true"
> foo false              # "false"
>
> This shelveset changes the grammar to support this feature and adds AST
> node ConditionalJumpExpression that represents <condition> and/or
> <jump-statement> expression. Also adds a unit test of the node.
> """

ConditionalJumpExpression is IronRuby AST node, not DLR AST node. This
is how it's implemented:

// constructor for Ruby construct "[condition] and [jump]"
ConditionalJumpExpression(Expression condition, JumpStatement jump)

// You cannot write to ConditionalJumpExpression

// Reading ConditionalJumpExpression
condition = this.condition.TransformRead();
tmp = CurrentCodeBlock.CreateTemporaryVariable(condition.Type);
return Comma(Assign(tmp, condition), Void(IfThen(OpCall("IsTrue",
tmp), this.jump.Transform())), Read(tmp));

So IronRuby first parses to IronRuby AST (for use with IDEs, and for
clarity and separation in general), and then IronRuby AST compiles to
(more complicated) DLR AST, usually calling back to langauge-specific
helpers.

-- 
Seo Sanghyeon

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" 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/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to