Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have a course in which the proffesor has asked us to create a DSL for a our final project. He presented us in the first courses xText with Eclipse. This being a new course, I am still a bit fuzzy on what Domain Specific Languages means.

This is my current understanding: a domain specific language is a language that is created for specific problems in software development. Examples of DSL's are PHP, SQL, JavaScript and on the opposite are languages like Java , C# , C++ , Ruby etc.

Please feel free to correct me if I am wrong.

What I would like to know: is there is any tool for .NET/Visual Studio that is similar to Xtext, that allows me to define a grammar and be allowed to generate a programming language based on that with an activity diagram?

share|improve this question
4  
PHP and Javascript are not really DSL's. A DSL is a language that addresses a particular problem domain, like medical services. SQL is a DSL because it is specific to the problem domain of working with relational data sets. See en.wikipedia.org/wiki/Domain-specific_language for more information. –  Robert Harvey Oct 15 '12 at 19:29
    
Nemerle maybe ? –  Heather Oct 16 '12 at 9:01
add comment

5 Answers

You can try ANTLR (or ANother Tool for Language Recognition) a parser generator that is among others available for dotnet. In the community you can find definitions for sql, c# and many other languages.

According to google there is also ide support:

share|improve this answer
add comment

The easiest way to go is a fluent interface. This requires no tools at all, and gives you great IntelliSense support, but you still have to write things in a .NET-kinda way, such as

 Mix.Paint(Color.Green).With.Paint(Color.Red);

Alternatively, you can write beautiful DSLs in Boo. There is an entire book on that subject.

share|improve this answer
add comment

There is a Visualization and Modeling SDK for Visual Studio which supports Text Templating (T4 templates) and Domain-Specific Languages.

http://msdn.microsoft.com/en-us/library/dd820703.aspx

share|improve this answer
add comment

Your first question - what is a domain specific language... because this is too big to fit in a comment.

A domain specific language is a language that is designed to work within a particular problem domain. For example, within the Unreal engine (used for first person shooters), there is a domain specific language called UnrealScript that allows one to modify the behavior of the Unreal engine. This language is designed for solving general problems but rather is constrained to its specific domain. Redcode (for corewars) would be another domain specific language. The language within Context Free Art is specific to its domain.

The idea is that with a domain specific language, one could create a DSL that closely maps the problem at hand. At this point, it is easier to program in the DLS than it is to program in a general language even with the added libraries to handle the problem domain.


As for your second question - the tools in C#... I don't know C# and thus don't know the tools that well. That said, back when I was taking a compiler class in college two of the tools that were used (and I have since used) are lex and yacc. Over at Stack Overflow... Lex/Yacc for C#?

share|improve this answer
add comment

This site may be interesting for you: http://nemerle.org . It's language for .net platform with rich metaprogramming features. More recently, the project is under the wing of the JetBrains: http://blogs.jetbrains.com/dotnet/2012/06/jetbrains-and-nemerle/ .

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.