General Question on DLR languages

I’m looking for some basic information on the DLR and I hoped this
would be a good place to get answers, or pointers to other resources.

My questions / understandings are:

  • If I am writing a language targeted for the CLR, I use
    System.Reflection.Emit to create IL. Is there “IL” for the DLR?
  • Is DLR code generated? Or is part of the “hosting” that it’s
    interpreted during runtime, and doesn’t have a codegen aspect?
  • Is Microsoft.Scripting.Host the core of the DLR? Is there a
    “Official” release of that ( I noticed at one time that IronPython and
    IronRuby were using different versions)
  • What is the relationship between Microsoft’s DLR support and the
    various language projects efforts (Where does MS DLR stop and other
    languages start).

Any help is greatly appreciated!


Greg A.
Software Development Manager
SSI Services

http://kc.vanadium.com
http://www.pghcodingdojo.org
http://www.insomnia-consulting.org/monologue

Greg A.:

  • If I am writing a language targeted for the CLR, I use
    System.Reflection.Emit to create IL. Is there “IL” for the DLR?

There are expression trees. You generate an expression tree and we
either transform them into IL or interpret them depending on the
context.

  • Is DLR code generated? Or is part of the “hosting” that it’s
    interpreted during runtime, and doesn’t have a codegen aspect?

See above.

  • Is Microsoft.Scripting.Host the core of the DLR? Is there a
    “Official” release of that ( I noticed at one time that IronPython and
    IronRuby were using different versions)

Microsoft.Scripting.Core (note the core) is the new core of the DLR.
This refactoring hasn’t hit SVN yet, but it will sometime today.

  • What is the relationship between Microsoft’s DLR support and the
    various language projects efforts (Where does MS DLR stop and other
    languages start).

Stuff inside of Microsoft.Scripting.* is DLR, stuff elsewhere (eg
IronRuby.dll or IronPython.dll) are the languages.

Thanks,
-John

Thanks for the quick response!! The more I look into this, the more
amazed I am by the amount of work and talent that must have gone into
Microsoft.Scripting and IronRuby

On Thu, Mar 20, 2008 at 11:17 AM, John L. (DLR) [email protected]
wrote:

  • If I am writing a language targeted for the CLR, I use
    System.Reflection.Emit to create IL. Is there “IL” for the DLR?

There are expression trees. You generate an expression tree and we either transform them into IL or interpret them depending on the context.

When you say “we” do you mean the IronRuby code, or Microsoft.Scripting?

Can you give me a starting class to look into to see how this is done?
I’m still not sure whether we’re talking about creating an expression
tree based on the syntax of whatever language is being interpreted,
and then walking the tree to transform/interpret


Greg A.
Software Development Manager
SSI Services

http://kc.vanadium.com
http://www.pghcodingdojo.org
http://www.insomnia-consulting.org/monologue

2008/3/21, Greg A. [email protected]:

  • If I am writing a language targeted for the CLR, I use
    System.Reflection.Emit to create IL. Is there “IL” for the DLR?

Yes. See classes under Microsoft.Scripting.Ast.

  • Is DLR code generated? Or is part of the “hosting” that it’s
    interpreted during runtime, and doesn’t have a codegen aspect?

Yes. See classes under Microsoft.Scripting.Generation. It is a IL code
generation backend.

Actual compiler is in Microsoft.Scripting.Ast.LambdaCompiler.
LambdaCompiler takes DLR AST and outputs IL using
Microsoft.Scripting.Generation.

  • Is Microsoft.Scripting.Host the core of the DLR? Is there a
    “Official” release of that ( I noticed at one time that IronPython and
    IronRuby were using different versions)

Microsoft.Scripting.Hosting is a shell around DLR. It doesn’t make
sense to release Microsoft.Scripting.Hosting only. Concerning the
official release, there is no official DLR release as far as I know.

  • What is the relationship between Microsoft’s DLR support and the
    various language projects efforts (Where does MS DLR stop and other
    languages start).

Language projects stop at language-specific parts. DLR starts at
language-common parts.

There are expression trees. You generate an expression tree and we
either transform them into IL or interpret them depending on the
context.

When you say “we” do you mean the IronRuby code, or Microsoft.Scripting?

Words like “You” or “we” are confusing. Better statement would be that
IronRuby generates an expression tree and Microsoft.Scripting compiles
the expression tree into IL or interprets it.

Greg A.:

Thanks for the quick response!! The more I look into this, the more
amazed I am by the amount of work and talent that must have gone into
Microsoft.Scripting and IronRuby

Thanks!

There are expression trees. You generate an expression tree and we
either transform them into IL or interpret them depending on the
context.

When you say “we” do you mean the IronRuby code, or
Microsoft.Scripting?

Microsoft.Scripting.

Can you give me a starting class to look into to see how this is done?
I’m still not sure whether we’re talking about creating an expression
tree based on the syntax of whatever language is being interpreted,
and then walking the tree to transform/interpret

Best place to look for this info is Martin Maly’s blog about DLR -
http://blogs.msdn.com/mmaly

Check out his ToyScript examples - they are much better to learn from
since a real language contains far more … um … crap :slight_smile:

Thanks,
-John

On Thu, Mar 20, 2008 at 6:36 PM, Shri B. [email protected]
wrote:

IronPython Blog | Microsoft Learn has a list of resources that would be of use to you.

I’ve been busy reading these articles, and reading code.

While comparing IronRuby and IronPython, I realized that the
Microsoft.Scripting is different. My assumption was that part was
“the DLR” from Microsoft, so it would be the same across all DLR based
languages.

Are the differences just version differences? For example,
Microsoft.Scripting.Ast.LambdaCompiler is in IronRuby, but not
IronPython.


Greg A.
Software Development Manager
SSI Services

http://kc.vanadium.com
http://www.pghcodingdojo.org
http://www.insomnia-consulting.org/monologue

has a list of resources that would be of use to you.

One link that I added recently is
http://www.dotnetguru.org/us/dlrus/DLR2.htm, which would quite useful
for someone starting to implement a new DLR language.

Thanks,
Shri
Want to work on IronPython, IronRuby, F#? Visit

Yes, they are just different snapshots of the same code base.

Tomas