Geeks With Blogs
Blog Moved to Blog Moved to
So, I can admit, I've been on a bit of a kick with compilers and such after my posts on DSLs, Compilers and the Irony of it All and Lang.NET and Rolling Your Own.  Today is no different, but this time, I'm just intrigued by targeting the DLR instead of the CLR.   Thankfully there are a few great references that people are doing right now for these little adventures.  One day once I'm more finished with the deep dive into F#, I'll dig a little deeper.

So, to get started, head on over to the IronPython download at CodePlex and let's get started.  The DLR doesn't compile down to MSIL, instead expression trees.  The DLR contains a set of expression trees that allow you to define variable assignments, functions, loops, if/then/else, and much more.  After making the DLR expression tree from the aforementioned pieces, the DLR handles the code.  This will be covered by Martin Maly in some of his posts.

Building Your Own DLR Language Series

Martin Maly from the Microsoft DLR team has started a series on building languages on top of the DLR.  The posts in the series are so far:
  • Building a DLR Language - ToyScript
    This post covers the basics of the ToyScript sample from the IronPython download.  This covers the tokenizer, parser and the Abstract Syntax Tree (AST).  This is the starter for the series.

  • Building a DLR Language - Trees
    This post covers that the ToyScript language generates not MSIL, but instead trees which the DLR then take care of the code generation.  This also covers the expressions that the DLR trees support

  • Building a DLR Language - Trees 2
    This is a follow-up to the previous post and covers the constructs for creating functions and lambdas. 

  • Building a DLR Language - Dynamic Behaviors
    This post covers dynamic behaviors, instead of the previous samples which covered static linked and strongly typed.  This sample covers arbitrarily adding two objects.

  • Building a DLR Language - Dynamic Behaviors 2
    This is a follow-up to the previous post on dynamic behaviors, and this time covers using the ActionExpression.  This time he digs into Reflector to show samples of the output.  Very cool stuff...

  • Building a DLR Language - Dynamic Behaviors 3
    In the final post so far in the series, it covers what happens when the DLR encounters a new runtime condition it hasn't seen and doesn't know yet how to handle.  These conditions are handled by Rules in the DLR sense.
Building on the DLR

Tomas Restrepo recently blogged about just that kind of adventure as well with some good posts recently.  Here are the ones so far:
  • Building On The DLR
    This is the first post in the series which gives an introduction to the basics and where to get started.

  • DLR Notes 1
    This post covers simple things such as declaring global and local functions and variables and the trials and tribulations.

  • DLR Notes 2
    This post is a rather long post about implementing function calls through Call Actions.  This includes such things as  call expressions,  IDynamicObject and ActionBinders

  • DLR Notes 3
    This is a follow-up which covers InvokeMember actions which are used to invoke instance members on .NET objects.

This is pretty exciting stuff as it has whetted my appetite for building dynamic languages.  My mind is still swimming with the possibilities of this, but to make one of these languages is simpler than ever.  Once again, I'll start taking that deep dive after I finish my F# kick, but I still thought I'd start gathering my resources now.

Until next time...

kick it on Posted on Friday, February 8, 2008 7:54 PM .NET | Back to top

Comments on this post: Adventures in Compilers - Building on the DLR

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Matthew Podwysocki | Powered by: