views:

424

answers:

5

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.

+2  A: 

Maybe you could give Oslo a try. Personally I haven't used it yet, but the examples are looking quite interesting.

"Oslo" consists of: A tool that helps people define and interact with models in a rich and visual manner A language that helps people create and use textual domain-specific languages and data models A relational repository that makes models available to both tools and platform components

Here is a sort of general overview!

David Klein
+3  A: 

You may still want to look at Boo's source code to see how they do things. They also use ANTLR to generate the parser. You don't need to mix any code in with ANTLR grammars—it can be useful as completely descriptive, as long as it's a LL(*) langauge.

Mark Cidade
really, I said I'm *not* interested in both Boo and ANTLR, so bare with me if I give this a -1
emaster70
You said that you weren't interested in using Boo as a language or mixing code with ANTLR grammars but I don't see how that precludes using straight ANTLR grammars and looking at Boo' source code.
Mark Cidade
A: 

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.

John Saunders
A: 

Easiest way to create a DSL in almost plain english: http://reboltutorial.com/blog/create-your-own-dsl-for-java-or-c-part-4-adding-a-semantic-layer/ Create your own DSL for Java or C# (part 4): adding a Semantic Layer

Rebol Tutorial
A: 

Irony - located at Irony@CodePlex might be a good solution for you - you can build your grammar utilizing the built-in functionality of .NET langauges instead of trying to build BNF grammar files separately.

saret