C# .NET - how to create a custom domain specific language using c#

Asked By aman on 03-Dec-11 01:58 AM
hi all,

i am thinking to create a my own custom domain specific language in windows application using c#.net....
but not getting, how exactly i can do this......so please help me with some example or nice article written on the same


thanks,
Suchit shah replied to aman on 03-Dec-11 02:15 AM

To create a domain-specific language solution

  1. Start the DSL Wizard.

    1. On the File menu, point to New, and then click Project.

    2. The New Project dialog box appears.

    3. Under Project types, expand the Other Project Types node, and click Extensibility.

    4. Click Domain-Specific Language Designer.

    5. In the Name box, type a name for the solution. Click OK.

      The Domain-Specific Language Designer Wizard appears.

      Note

    Create DSL dialog
  2. Choose a DSL template.

  3. On the Select Domain-Specific Language Options page, select one of the solution templates such as Minimal Language. Choose a template that is similar to the DSL that you want to create.

    For more information about solution templates, see http://msdn.microsoft.com/en-us/library/bb126490.aspx.

  4. Enter a filename extension on the File Extension page. It should be unique in your computer, and in any computers on which you want to install the DSL. You should see the message No applications or Visual Studio editors use this extension.

    • If you have used the file name extension in previous experimental DSLs that have not been fully installed, you can clear them out by using the Reset the Experimental Instance tool, which can be found in the Visual Studio SDK menu.

    • If another Visual Studio Extension that uses this file extension has been fully installed on your computer, consider uninstalling it. On the Tools menu, click Extension Manager.

  5. Inspect, and if necessary adjust, the fields in the remaining pages of the wizard. When you are satisfied with the settings, click Finish. For more information about the settings, see http://msdn.microsoft.com/en-us/library/bb126593.aspx#settings.

    The wizard creates a solution that has two projects, which are named Dsl and DslPackage.

Suchit shah replied to aman on 03-Dec-11 02:16 AM
This two-part article is aimed at experienced C# .NET programmers who wish to write their own little computer languages (see http://www.codeproject.com/KB/recipes/YourFirstDSLPart2.aspx here). Historically, this has been reasonably difficult due to requiring in-depth knowledge of compilation theory and/or the use of one or more tools, each of which had its own learning curves. Recently though, there has been somewhat of a revolution in this area, with tools being developed which greatly simplify the writing of compilers. http://www.codeplex.com/irony/ for .NET is used in this tutorial due to the fact that it requires no configuration files etc. (Just drop the Irony DLL into your project) and it simplifies many aspects of compiler construction.

Refer :
http://www.codeproject.com/KB/recipes/YourFirstDSL.aspx

http://msdn.microsoft.com/en-us/library/bb126593.aspx
Anoop S replied to aman on 03-Dec-11 04:40 AM
domain-specific language (DSL) is a programming language or specification language dedicated to a particular problem domain, a particular problem representation technique, and/or a particular solution technique. The concept isn't new—special-purpose programming languages and all kinds of modeling/specification languages have always existed, but the term has become more popular due to the rise of domain-specific modeling.

Refer this article for how to create DSL
http://www.udooz.net/article/9-dsl/11-domain-specific-language-using-c-40.html

and This video tutorial from MSDN ->Create and Customize My Domain Specific Language
http://msdn.microsoft.com/en-us/vstudio/Video/cc296539