Sympl Language Sample and Walkthrough Document

Coordinator
May 14, 2009 at 1:00 AM
There’s a new DLR sample to which I wanted to draw folks’ attentions. There is a small language implementation sample, implemented in both IronPython and C#, with an accompanying walkthrough document. The code is now on the DLR Codeplex site under ...\Languages\Sympl, and the document is on the “Documents and Specs” page which you can get to from the list of links on the home page. Under the Sympl directory is also an examples directory with some code written in Sympl, which all runs when you execute Main in program.cs. The code and document will be in zip files we will produce to go along with the VS Beta1 release coming soon.
Sympl demonstrates how to implement a very simple language using the Dynamic Language Runtime (DLR) as it ships in .NET 4.0. The goal is to make you aware of how to get started building a language on the DLR. Sympl does not show production quality rich .NET interoperability and binding logic. It does walk you through the following:
  • Using DLR Expression Trees (which include LINQ Expression Trees v1) for code generation
  • Using DLR dynamic dispatch caching
  • Building runtime binders
  • Building dynamic objects and dynamic meta-objects
  • Supporting dynamic language/object interoperability
  • Very simple hosting with application supplied global objects
  • Basic arithmetic and comparison operators with fast DLR dispatch caching
  • Control flow
  • Name binding within Sympl
  • Method and top-level function invocation with fast DLR dispatch caching
  • Very simple .NET interoperability for runtime method and operation binding
  • Using the DLR’s built-in COM binding
  • Closures
  • Assignment with various left-hand-side expressions
Sympl does not yet demonstrate using any Codeplex-only DLR code such as the DefaultBinder, the faster and nicer .NET reflection trackers (Sympl’s is painfully slow and simple), or the common DLR hosting (yet).
A few caveats on the documentation. First, the walk through document still needs some polishing, but I wanted to get it out to people. Feel free to send me comments or ask questions. Second, the document refers to a couple of other documents on our Codeplex site, but we haven’t updated some of them since DEC 08. Those will be updated in the next couple of weeks. I think the sympl.doc walkthrough is very readable on its own and has all the relevant code snippets included in it as well. Lastly, while the example is overall reasonably simple, it does demonstrate all the basic concepts of building a language on the DLR with explanations, and therefore, is quite long. However, the document unfolds in the same way the Sympl language implementation evolved, so it progresses well for incrementally increasing your awareness of how to build a language on the DLR.
Hope you enjoy and find this code and doc helpful!
Cheers,
Bill
May 14, 2009 at 1:25 AM
Thanks so much for this Bill. I've been looking forward to reading it.

Mike Kohout
May 14, 2009 at 11:14 AM

Bill,

Thank you very much for this, it provides a very nice intro into developing a language on the DLR.

 

In the above post you mention some DLR features that are only on the Codeplex version of the DLR, as do several of the DLR documents.  Is there someplace that lists these differences, perhaps along with a short description?  If not, might I suggest that would make a good wiki page for the Codeplex DLR site.

 

Thanks again!

-mark

 

Coordinator
May 14, 2009 at 5:52 PM

That’s a good suggestion.  I don’t really want to do a laundry list of types, but I could put together something.  One easy way to discern what’s in CLR 4.0 and what’s staying on codeplex only is to use Reflector on Microsoft.scripting.core.dll vs. Microsoft.scripting.dll.  The ...core.dll contains what we’re shipping in CLR 4.0.  Some of the stuff from Microsoft.scripting.dll may move into the CLR over time, such as common hosting APIs, the default binding, some more Expression Tree node types, etc.  We definitely want to iterate on some of that, get feedback, and bake it a bit more before driving it into a CLR version.  We’re not sure of the timeline for that yet since we’re focused on CLR 4.0 right now and only just musing about what might be in the next CLR release.

Cheers,

Bill

From: mwatts42 [mailto:notifications@codeplex.com]
Sent: Thursday, May 14, 2009 3:15 AM
To: Bill Chiles
Subject: Re: Sympl Language Sample and Walkthrough Document [dlr:56240]

From: mwatts42

Bill,

Thank you very much for this, it provides a very nice intro into developing a language on the DLR.

In the above post you mention some DLR features that are only on the Codeplex version of the DLR, as do several of the DLR documents. Is there someplace that lists these differences, perhaps along with a short description? If not, might I suggest that would make a good wiki page for the Codeplex DLR site.

Thanks again!

-mark

Read the full discussion online.

To add a post to this discussion, reply to this email (dlr@discussions.codeplex.com)

To start a new discussion for this project, email dlr@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

May 14, 2009 at 5:58 PM

Given that we ship the source code, you don't actually need Reflector :). Just look at Microsoft.Scripting.csproj and compare what's in there with what's in Microsoft.Scripting.Core.csproj.

May 14, 2009 at 8:09 PM

Curt mentions just doing a source diff which I can do. :)  And I agree a laundry list of types is not what I want either.  To be more precise about what I was looking for was was a callout of

* specific areas/types that MS is looking for input on that you want feedback on
* particular types/functionality that is particularly useful in specific scenerio's - an example of which might be the GeneratorFunctionExpression that you mention in sympl.doc section 23.4
* areas where the differences between the shipping .NET 4.0 version and the DLR version might cause portability problems in porting concepts.  There probably are not many of those yet, especially since we don't have the 4.0 version shipping yet (much less HAVE it.) :) but I expect there will be problems like that in the future.

Basically just a callout of "Hey here are things to be aware of, we need input on, don't fall off this cliff" type of stuff.

Thanks
-mark