InfoQ

News

Programming for the DLR

Posted by Werner Schuster on Jan 21, 2008 05:00 PM

Community
.NET,
Ruby
Topics
Silverlight,
Scripting,
.NET Framework
Tags
IronPython,
RubyDotNet,
JVM,
DLR
The IronRuby team is busy moving forward on both the Ruby implementation and the underlying Dynamic Language Runtime (DLR). The latter is a group of various APIs and systems all (dynamic) language implementations for .NET (might) need. By pulling out this functionality into a common library, creating new language implementations will become much easier. A new blog about the using the DLR to build language implementations now provides practical insight in the design of the DLR.

An example is how the DLR factors out IL code generation:
The ToyScript sample language's front-end is very similar to that of any traditional compiler. It has tokenizer, parser and an abstract syntax tree representation of the toy language. What makes it a DLR based language (from the compiler pipeline perspective) is that instead of generating its own intermediate code, or generating Microsoft .NET IL directly, ToyScript will generate a tree representation of the code - DLR Trees. Dynamic Language Runtime will then take care of the code generation.

The DLR Trees are essentially the DLR representation of programs so every language that targets DLR produces the DLR Trees. ToyScript's design is similar to that of all the other DLR based languages, such as IronPython or IronRuby in the sense that it first parses into its own AST and then generates the DLR trees. At one point ToyScript (being very simple language) parsed directly into the DLR trees, but we changed that to behave more like the other DLR based languages, even though for ToyScript it is not strictly necessary.

By generating the DLR Trees instead of IL, the compiler writer doesn't have to worry about the IL generation and the DLR will take care of the intricacies. The developer can then focus on the correct semantic of the language at hand by implementing the front-end and implementing the correct runtime semantic.

The blog, written by Martin Maly who works at Microsoft on IronPython and the DLR, uses a toy language, conveniently named ToyScript, to show basic principles of the DLR. Future topics will also focus on how the DLR is used in IronPython or IronRuby.

This project also shows the kind of services a common language runtime library can provide - a similar project called JLR was attempted for the Java platform. While the JLR project seems mostly abandoned (with only one library in the SVN repository), the accompanying JVM Languages list is busy and shows that language implementations for the JVM face very similar design issues.

As for general IronRuby progress, read InfoQ's recent John Lam interview.

5 comments

Reply

Another good interview by Fabio Akita Posted Jan 17, 2008 4:07 PM
Re: Another good interview by Robert Bazinet Posted Jan 17, 2008 10:26 PM
Re: Another good interview by Fabio Akita Posted Jan 30, 2008 2:26 PM
Re: Another good interview by Robert Bazinet Posted Feb 13, 2008 1:23 PM
First Class Support on VS 2008 Required by Soft Mind Posted Jan 23, 2008 11:08 PM
  1. Back to top

    Another good interview

    Jan 17, 2008 4:07 PM by Fabio Akita

    I would recommend this other interview with John Lam as well, it greatly complements this one :-) http://www.akitaonrails.com/2007/11/12/chatting-with-john-lam-ironruby

  2. Back to top

    Re: Another good interview

    Jan 17, 2008 10:26 PM by Robert Bazinet

    Nice interview. I agree, it does complement this one as well. Do you have an English-only feed?

  3. Back to top

    First Class Support on VS 2008 Required

    Jan 23, 2008 11:08 PM by Soft Mind

    Hi, If i am not wrong Mr.Scottgu has accepted IronRuby as a first Class Citizen for DLR. I think IronRuby inbuilt integration in VS2008 like C# and Vb.Net is a must, without this support, IronRuby would not be taken in a serious manner and would be treated like an orphan child, with no goals. I do not like the idea of depending just on a third party tool. Let Sapphire Steel come as an option as Free Vs Paid IDE. If MSFT is considering IronRuby and IronPython their own baby, than it should be proved with such integration. SoftMind.

  4. Back to top

    Re: Another good interview

    Jan 30, 2008 2:26 PM by Fabio Akita

    Hi, sorry for the long delay!! Yes, now I do have an english-only feed: feed://feeds.feedburner.com/AkitaOnRailsEnglish Cheers

  5. Back to top

    Re: Another good interview

    Feb 13, 2008 1:23 PM by Robert Bazinet

    No problem, I just realized it myself. Thank you for the feed link. -Rob

Exclusive Content

Rationalizing the Presentation Tier

Thin client paradigm characterized by web applications is a kludge that needs to be repudiated. Old compromises are no longer needed and it's time to move the presentation tier to where it belongs.

Agile Project Management: Lessons Learned at Google

In this presentation filmed during QCon 2007, Jeff Sutherland, the creator of Scrum, talks about his visit at Google to do an analysis of Google's first implementation of Scrum.

AtomServer – The Power of Publishing for Data Distribution

In this article, Bryon Jacob and Chris Berry introduce AtomServer, their implementation of a full-fledged Atom Store based on Apache Abdera, which is now available as open source.

An Introduction to Virtualization

It is easy to think that virtualization applies only to servers. In reality the recent resurgence of the concept is also being applied to networking, storage, and application infrastructure.

REST Anti-Patterns

In this article, Stefan Tilkov explains some of the most common anti-patterns found in applications that claim to follow a "RESTful" design and suggests ways to avoid them.

Choosing between Routing and Orchestration in an ESB

In this article, Adrien Louis and Marc Dutoo discuss the differences and relative merits of using orchestration vs. routing in a typical ESB setup, and discuss various implementation options.

Enterprise Batch Processing with Spring

Wayne Lund discusses batch processing, Spring Batch objectives and features, scenarios for usage, Spring Batch architecture, scaling, example code, failures and retrying, and the future roadmap.

User Story Estimation Techniques

Developer Jay Fields draws on his experiences as a ThoughtWorks consultant to describe effective user story estimation techniques.