(Posting this on behalf of Bill Chiles, who’s done an awesome job with
Sympl. The document itself can be found
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
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
- Control flow
- Name binding within Sympl
- Method and top-level function invocation with fast DLR dispatch
- Very simple .NET interoperability for runtime method and operation
- Using the DLR’s built-in COM binding
- 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!