Search code examples
.netparsingdsldsl-tools

Tools to build a DSL in .NET


I'm getting teased more and more into developing DSLs. I've developed a tiny one with F# using fslex and fsyacc but the error messages are inaccurate (I also can't find a way to generate better ones, there seems to be little documentation on how to handle error cases) and the fact that they won't parse UNICODE strings adequately is not acceptable to me. Long story short, I'm looking for tools making it pretty simple to develop a DSL (the Visual Studio tools for that are really nothing like what I'm after) and I'm most interested in the parsing/AST generation part. I've looked at ANTLR and mixing up code and grammar definition meta-language looks bad to me, so please don't mention it or solutions suffering from a similar issue in the answers. Also, I've seen there's some stuff for a language named Boo but I'm really not interested in messing with yet another language (especially if it has little support) right now, so that doesn't fit either. Any other suggestion is appreciated, as long as it's decently documented, works fine with .NET and last but not least doesn't involve the use of a dynamically typed language or use of the DLR.


Solution

  • You want to start working with Oslo. It includes the tools to define the DSL and tools for defining grammars over the DSL. The grammars can either emit an AST or anything else.

    One kind of output it can generate from the DSL is ia corresponding SQL Server schema. Instances of the DSL can therefore be stored in SQL Server Express (or above).

    Oslo is part of a larger vision that Microsoft has, but you can ignore that and just get started with the "DSL" part.

    I recommend you get started and get active in letting Microsoft know what you like and dislike about it. You've got their attention right now, whether you know it or not.