This project is read-only.

Roslyn, the DLR and DSLs

Topics: General
Feb 10, 2015 at 3:11 PM

I understand how the .NET Compiler Platform affects analysis tools, IDE integration, how it allows C# and VB.Net to be scripted.

How does it sit in terms of new languages on top of .NET? If the IronPython team were starting today for example would they still be better off with the DLR or could they implement it via the .NET Compiler Platform?
Feb 10, 2015 at 3:48 PM
Roslyn was not designed as a platform for writing compilers for other languages. Some of the code that integrates with Visual Studio will be helpful to other languages, but the API design is very tightly coupled to how C# and VB work.
Feb 11, 2015 at 7:27 PM
Hi Alan,

Another way to think of it is that the "Roslyn" VB and C# compilers are fully functional compilers for .NET languages written in .NET. They're useful for making new languages because they are samples of how to compile rather complex existing languages. If I were making my own brand new language today the first thing I'd do would be to clone either the VB or C# compiler (depending on the nature of the language) and modify it to fit my needs. The patterns we use for lexing, parsing, metadata, symbols, binding, lowering, emitting, etc are all generally valuable. We don't have explicit extension points defined for that purpose but the source can be freely copied and modified. Most of our code sharing happens in the metadata reading and binary code gen in the common DLL and in the IDE. Aside from that the VB and C# compilers are really just very similarly implemented compilers which use the same patterns; there wouldn't be an issue extending that to IronPython.

Multiple teams within Microsoft have taken the approach of forking the "Roslyn" compilers for research languages or DSLs.


Anthony D. Green, Program Manager, Visual Basic and C# Languages Team
Feb 12, 2015 at 8:48 AM
Thanks Anthony.
Mar 19, 2015 at 4:57 PM
Alan, you can check

This is a full Roslyn-based language development platform that now includes custom grammars for DSLs. Instead of creating new standalone languages it does something more useful, allowing language developers to embed their languages (extensions) in c#.

It is not made by multiple Microsoft teams, but it does have 20 some examples.

Mar 19, 2015 at 5:06 PM

Thanks. FWIW, all the links on your GitHub Many More Examples page are 404.
Mar 19, 2015 at 5:14 PM
Edited Mar 19, 2015 at 5:20 PM

Yikes! I moved the files to another project (Excess.Extensions.XS), thanks and I will change the links right away!

Edit: Links are fine now, also, if you are interested in DSLs here is a video of how to make a json extension based on a custom grammar:

Thanks for the heads up and if you have any comments or questions do not hesitate to contact me.