你写了什么样的问题?

时间:2022-05-24 11:40:05

I'm just curious about Domain-Specific Languages. I have seen them several times in articles, and it seems that they can be used outside assurance or bank data definition problems.

我只是对领域特定语言感到好奇。我在文章中已经多次看到它们,似乎它们可以在保证或银行数据定义问题之外使用。

So I come to SO to have some concrete input.

所以我来到SO有一些具体的输入。

Did you ever use a DSL? Write one. If yes, what's it feel like?

你有没有使用过DSL?写一个。如果是的话,感觉如何?

Do you think one of your projects could be better (more productive, more maintainable, ...) with a DSL?

你认为你的一个项目可以用DSL更好(更高效,更易维护......)吗?

Edit : I'm sorry to put this after, but i was meanning a specific DSL that you wrote yourself. It's exclude Tex, HTML, Make , SQL. I fact, the question was more : "writing a DSL"

编辑:我很抱歉把它放在后面,但我的意思是你自己编写的特定DSL。它排除了Tex,HTML,Make,SQL。事实上,问题更多:“编写DSL”

12 个解决方案

#1


I was one of the people that worked on NUnit version 2.0 and up for a few years. It is a DSL written using C# attributes to describe unit tests. It isn't the most obvious example of a DSL, but I have come to think of it as one. I have written some other ones using ANTLR and even MGrammar. The experience is often the same. As soon as you show it to someone else they want to do a bunch of things you never thought of. That's a good thing, but you have to be prepared to keep going and add functionality.

我是NUnit 2.0版本上工作了几年的人之一。它是使用C#属性编写的DSL来描述单元测试。它不是DSL的最明显的例子,但我已经把它想象成一个。我用ANTLR甚至MGrammar写了一些其他的。经验往往是一样的。一旦你向其他人展示,他们就想做一些你从未想过的事情。这是一件好事,但你必须准备继续前进并添加功能。

I'm now in the habit of thinking about and writing DSLs quite often. The current object relational mapper I use is a dsl. It isn't a new language. It is pure C#, but by thinking of the language of the Domain, and that Domain is more than just Business Domain, we created a mini language to map objects. Thinking in terms of DSLs has changed our approach to API and framework building.

我现在习惯于经常思考和编写DSL。我使用的当前对象关系映射器是dsl。它不是一种新语言。它是纯粹的C#,但通过考虑域的语言,并且Domain不仅仅是Business Domain,我们创建了一种用于映射对象的迷你语言。从DSL的角度思考已经改变了我们的API和框架构建方法。

#2


I'd say there is quite a continuum between very readable API as a weak form of DSL (what some call a fluent interface), an internal DSL as something in between and a full grammar-defined external DSL on the other end.

我会说,非常易读的API作为DSL的弱形式(有些人称之为流畅的接口),内部DSL作为介于两者之间的东西和另一端的完整语法定义的外部DSL之间存在着相当大的连续性。

The weakest form is something that I kind of always try to achieve (i.e. make the API as closest to the problem domain as possible). A DSL on the other end of the continuum makes a lot of sense if non-programmers will be using the software, e.g. to enter data.

最弱的形式是我总是试图实现的(即使API尽可能最接近问题域)。如果非程序员将使用该软件,则连续体另一端的DSL非常有意义。输入数据。

And with a framework like Xtext even a full external DSL, including an editor supporting syntax coloring and error checking is much easier to implement than it might initially seem.

使用像Xtext这样的框架甚至是完整的外部DSL,包括支持语法着色和错误检查的编辑器比最初看起来更容易实现。

#3


SQL's a good example Michael Dorfman gave. Others I have used extensively are:

SQL是Michael Dorfman给出的一个很好的例子。我广泛使用的其他人是:

  • UIL - GUI building
  • UIL - GUI建设

  • Make - program building and installing
  • 制作 - 程序构建和安装

  • regexp - String pattern matching
  • regexp - 字符串模式匹配

  • lex and yacc - lexical analyzer and compiler creation
  • lex和yacc - 词法分析器和编译器创建

As for how it works out, I think it depends on the language and the domain. UIL is out-and-out awesome for specifying GUI's. If you do the same thing in inline Motif code, GUI specification errors that the UIL compiler catches look like perfectly compilable code to a C or Ada compiler. That causes tons more time to be wasted debugging. Plus, it just plain looks uglier in general-purpose code using Motif API calls.

至于它如何运作,我认为这取决于语言和领域。 UIL对于指定GUI来说是非常棒的。如果你在内联Motif代码中执行相同的操作,那么UIL编译器捕获的GUI规范错误看起来就像是C或Ada编译器的完全可编译代码。这导致浪费更多时间浪费调试。另外,使用Motif API调用的通用代码看起来很简单。

Make can really get to be a nightmare, but there aren't a lot of tools out there that can do what it does, and I suspect they all have the same problem.

Make真的可以成为一场噩梦,但是没有很多工具可以做它做的事情,我怀疑它们都有同样的问题。

Regular expressions are unneeded for very simple tasks, and a nightmare for really complex ones. For those in the middle, they are a wonderful tool.

正则表达式对于非常简单的任务是不必要的,对于非常复杂的任务来说是一场噩梦。对于那些中间人来说,他们是一个很棒的工具。

Lex and yacc can be quite helpful. However, a person who knows what they are doing can create parsers and lexical analyzers by hand with about the same amount of work.

Lex和yacc非常有帮助。但是,知道自己在做什么的人可以手工创建解析器和词法分析器,并且工作量相同。

#4


Your question is quite well timed. I have recently written a DSL using the tool Antlr. Antlr is a parser/lexer generator.
It allows easy construction of DSLs (and many other things) and when coupled with StringTemplate (written by the same person) becomes very powerful in code generation. It also can target multiple languages. Our parser and lexer is in C# (one of the targets) even though the default is Java.

你的问题很合适。我最近使用工具Antlr编写了一个DSL。 Antlr是一个解析器/词法分析器生成器。它允许轻松构建DSL(以及许多其他东西),当与StringTemplate(由同一个人编写)结合使用时,代码生成变得非常强大。它还可以针对多种语言。我们的解析器和词法分析器在C#(目标之一)中,即使默认值是Java。

One of the numerous benefits of Antlr are the descriptive error messages and the IDE/debugger (AntlrWorks) which allows you to step through your grammar and see the AST trees visually.

Antlr的众多优点之一是描述性错误消息和IDE /调试器(AntlrWorks),它允许您逐步查看语法并直观地查看AST树。

John Saunders suggested below the use of the built in visual studio DSL toolkit. Ultimately, I found those tools to be far to constricting. To require a GUI, without any ability to easily describe an underlying textual grammar, just seems inadequate for my needs.

John Saunders在下面建议使用内置的visual studio DSL工具包。最终,我发现这些工具远远不能收缩。要求GUI,没有任何能够轻松描述基础文本语法的能力,似乎不足以满足我的需求。

Along with the DSL parser/lexer I have also written a Visual Studio Language service, to provide intellisense, error highlighting, code completion and template items/projects.

除了DSL解析器/词法分析器,我还编写了一个Visual Studio语言服务,以提供智能感知,错误突出显示,代码完成和模板项目/项目。

Even if you dont implement the extras, a DSL can simplify repetitive work. My DSL specifically targets the CSLA framework, generating business objects easily with all the plumbing, allowing the developers to only worry about business logic.

即使你没有实现附加功能,DSL也可以简化重复性工作。我的DSL专门针对CSLA框架,使用所有管道轻松生成业务对象,允许开发人员只关心业务逻辑。

Here is a small example of the DSL:

以下是DSL的一个小例子:

datadef Object1Datadef
{

   tables
   {
      MyTable:PK[MyTableID], column1, column2;
   }

}

root MyObject
{
    datadef Object1Datadef;

    read "all";
    write "admin", "superusers";

    int _Myvariable;    

}

If your DSL allows you to describe your domain faster, more easily and increases productivity, then it is worthwhile.

如果您的DSL允许您更快,更轻松地描述您的域并提高生产力,那么这是值得的。

#5


I think the DSL most of us use most often is SQL, a little language for data manipulation and extraction.

我认为我们大多数人经常使用的DSL是SQL,一种用于数据操作和提取的小语言。

#6


Two recent uses of a DSL:

最近使用DSL的两个方面:

  1. Using the construct library - which basically defines a DSL for describing binary structures of data (such as file formats) and protocols.
  2. 使用构造库 - 它基本上定义了一个DSL,用于描述数据的二进制结构(如文件格式)和协议。

  3. Implementing a Python-based DSL for verifying hardware. This DSL lays out all the infrastructure required to write tests as "scenario functions" that can use the underlying DSL components.
  4. 实现基于Python的DSL以验证硬件。此DSL列出了将测试编写为可以使用底层DSL组件的“场景功能”所需的所有基础结构。

#7


Actually, you use DSLs almost everyday without knowing it... HTML, make, XML, latex and many many configuration languages...

实际上,你几乎每天都使用DSL而不知道它... HTML,make,XML,latex和许多配置语言......

I enjoy having a declarative DSL that generates a bunch of things...It feels good...

我喜欢使用声明式DSL生成一堆东西......感觉很好......

What is the impact of a DSL is an interesting but really difficult to assess... If your DSL is well designed for the targeted community (the targeted community is a really important point...) in terms of what this community is expecting and does well the job it is supposed to do, it's going to feel good...

DSL的影响是多么有趣但很难评估...如果你的DSL是针对目标社区设计的(目标社区是一个非常重要的一点......)就这个社区的期望而言做得好应该做的,感觉很好......

However, if you design a DSL without knowing the community or if they need to constantly fight with the limitations of the language (a DSL can still be turing-complete...), it's going to hurt...

但是,如果您在不了解社区的情况下设计DSL,或者他们是否需要经常与语言的限制作斗争(DSL仍然可以完成图片......),那将会受到伤害......

#8


In my experience, any software-engineering organization will create DSLs in response to repeated problems and too much template code being written. A short extract from my personal experience:

根据我的经验,任何软件工程组织都会创建DSL以响应重复的问题并编写太多的模板代码。从我的个人经历中摘录一下:

  • Compiler bottom-up rewrite-system generators
  • 编译器自下而上的重写系统生成器

  • Assembler generators
  • Object-code generators (implemented as a C++ library with operator overloading)
  • 对象代码生成器(实现为带有运算符重载的C ++库)

  • CPU simulator generator
  • CPU模拟器生成器

  • Simulator device model generator
  • 模拟器设备模型生成器

  • Command-line languages for interactive tools
  • 交互式工具的命令行语言

Also note that many file formats can be considered DSLs if you look closely.

另请注意,如果仔细观察,可以将许多文件格式视为DSL。

There was a good article by Mark Shapiro in ACM Queue a while back about this phenomenon too.

马克夏皮罗(Mark Shapiro)在ACM Queue上发表了一篇很好的文章。

Yet another example is the way in which users end up writing big programs in things not intended for it... like test benches using the old "SNIFF" debugger scripting language.

另一个例子是用户最终用不适合它的东西编写大型程序的方式......就像使用旧的“SNIFF”调试器脚本语言的测试台一样。

#9


This might be an old question, but the question in the title (rather than in the body) has not really been answered by anyone:

这可能是一个老问题,但标题中的问题(而不是在正文中)并没有真正被任何人回答:

There are two (dual) instances in which it makes sense to write a DSL:

有两个(双)实例,编写DSL是有意义的:

  • When the problem-domain is very well understood and has pre-existing vocabulary of nouns (objects), verbs (actions, combinators, etc) and adjectives (attributes, modifiers).
  • 当问题域被很好地理解并且具有名词(对象),动词(动作,组合器等)和形容词(属性,修饰符)的预先存在的词汇。

  • When the solution-domain is very well understood and ...
  • 当解决方案领域得到很好的理解并且......

Regular expressions are a good example of the first, while assembler-generators the second. General purpose programming language are there for the rest: when neither the problem-domain nor the solution-domain is that well understood, and so general tools have to be brought to bear.

正则表达式是第一个的好例子,而汇编程序生成器则是第二个。其他通用编程语言是存在的:当问题域和解决方案域都没有被很好地理解时,因此必须使用通用工具。

#10


How about BNF as a DSL for parser generators?

如何将BNF作为解析器生成器的DSL?

#11


DSLs created with the Visual Studio DSL Toolkit can be used to generate any text-based artifact from an instance of the domain model defined by the DSL. Of course, being inside of Visual Studio at the time, if there's a compiler or other processor for the text artifact, then it can automatically be run.

使用Visual Studio DSL Toolkit创建的DSL可用于从DSL定义的域模型的实例生成任何基于文本的工件。当然,当时在Visual Studio内部,如果有文件工件的编译器或其他处理器,那么它可以自动运行。

Some examples are

一些例子是

  • NORMA, a DSL for conceptual domain modeling, based on Object-Role Modeling notation (ORM2)
  • NORMA,用于概念域建模的DSL,基于对象角色建模表示法(ORM2)

  • Web Service Software Factory, which uses three DSLs to model web services
  • Web服务软件工厂,它使用三个DSL来建模Web服务

  • Configuration Section Designer - used to define the schema for XML configuration files and to generate the classes to expose the data from them.
  • 配置节设计器 - 用于定义XML配置文件的模式并生成类以从中公开数据。

And, of course, you can create your own.

当然,你可以创建自己的。

#12


I am still a student, but I am really fascinated with spirit

我还是学生,但我对精神很着迷

I've used it little bit throughout my 'programming languages' course. This is how it works, basically you are writing EBNF.

我在“编程语言”课程中使用了一点点。这是它的工作原理,基本上你是在写EBNF。

alt text http://img6.imageshack.us/img6/1461/reala.png

替代文字http://img6.imageshack.us/img6/1461/reala.png

becomes this in C++ ;)

在C ++中成为这个;)

alt text http://img6.imageshack.us/img6/8809/dsl.png

替代文字http://img6.imageshack.us/img6/8809/dsl.png

#1


I was one of the people that worked on NUnit version 2.0 and up for a few years. It is a DSL written using C# attributes to describe unit tests. It isn't the most obvious example of a DSL, but I have come to think of it as one. I have written some other ones using ANTLR and even MGrammar. The experience is often the same. As soon as you show it to someone else they want to do a bunch of things you never thought of. That's a good thing, but you have to be prepared to keep going and add functionality.

我是NUnit 2.0版本上工作了几年的人之一。它是使用C#属性编写的DSL来描述单元测试。它不是DSL的最明显的例子,但我已经把它想象成一个。我用ANTLR甚至MGrammar写了一些其他的。经验往往是一样的。一旦你向其他人展示,他们就想做一些你从未想过的事情。这是一件好事,但你必须准备继续前进并添加功能。

I'm now in the habit of thinking about and writing DSLs quite often. The current object relational mapper I use is a dsl. It isn't a new language. It is pure C#, but by thinking of the language of the Domain, and that Domain is more than just Business Domain, we created a mini language to map objects. Thinking in terms of DSLs has changed our approach to API and framework building.

我现在习惯于经常思考和编写DSL。我使用的当前对象关系映射器是dsl。它不是一种新语言。它是纯粹的C#,但通过考虑域的语言,并且Domain不仅仅是Business Domain,我们创建了一种用于映射对象的迷你语言。从DSL的角度思考已经改变了我们的API和框架构建方法。

#2


I'd say there is quite a continuum between very readable API as a weak form of DSL (what some call a fluent interface), an internal DSL as something in between and a full grammar-defined external DSL on the other end.

我会说,非常易读的API作为DSL的弱形式(有些人称之为流畅的接口),内部DSL作为介于两者之间的东西和另一端的完整语法定义的外部DSL之间存在着相当大的连续性。

The weakest form is something that I kind of always try to achieve (i.e. make the API as closest to the problem domain as possible). A DSL on the other end of the continuum makes a lot of sense if non-programmers will be using the software, e.g. to enter data.

最弱的形式是我总是试图实现的(即使API尽可能最接近问题域)。如果非程序员将使用该软件,则连续体另一端的DSL非常有意义。输入数据。

And with a framework like Xtext even a full external DSL, including an editor supporting syntax coloring and error checking is much easier to implement than it might initially seem.

使用像Xtext这样的框架甚至是完整的外部DSL,包括支持语法着色和错误检查的编辑器比最初看起来更容易实现。

#3


SQL's a good example Michael Dorfman gave. Others I have used extensively are:

SQL是Michael Dorfman给出的一个很好的例子。我广泛使用的其他人是:

  • UIL - GUI building
  • UIL - GUI建设

  • Make - program building and installing
  • 制作 - 程序构建和安装

  • regexp - String pattern matching
  • regexp - 字符串模式匹配

  • lex and yacc - lexical analyzer and compiler creation
  • lex和yacc - 词法分析器和编译器创建

As for how it works out, I think it depends on the language and the domain. UIL is out-and-out awesome for specifying GUI's. If you do the same thing in inline Motif code, GUI specification errors that the UIL compiler catches look like perfectly compilable code to a C or Ada compiler. That causes tons more time to be wasted debugging. Plus, it just plain looks uglier in general-purpose code using Motif API calls.

至于它如何运作,我认为这取决于语言和领域。 UIL对于指定GUI来说是非常棒的。如果你在内联Motif代码中执行相同的操作,那么UIL编译器捕获的GUI规范错误看起来就像是C或Ada编译器的完全可编译代码。这导致浪费更多时间浪费调试。另外,使用Motif API调用的通用代码看起来很简单。

Make can really get to be a nightmare, but there aren't a lot of tools out there that can do what it does, and I suspect they all have the same problem.

Make真的可以成为一场噩梦,但是没有很多工具可以做它做的事情,我怀疑它们都有同样的问题。

Regular expressions are unneeded for very simple tasks, and a nightmare for really complex ones. For those in the middle, they are a wonderful tool.

正则表达式对于非常简单的任务是不必要的,对于非常复杂的任务来说是一场噩梦。对于那些中间人来说,他们是一个很棒的工具。

Lex and yacc can be quite helpful. However, a person who knows what they are doing can create parsers and lexical analyzers by hand with about the same amount of work.

Lex和yacc非常有帮助。但是,知道自己在做什么的人可以手工创建解析器和词法分析器,并且工作量相同。

#4


Your question is quite well timed. I have recently written a DSL using the tool Antlr. Antlr is a parser/lexer generator.
It allows easy construction of DSLs (and many other things) and when coupled with StringTemplate (written by the same person) becomes very powerful in code generation. It also can target multiple languages. Our parser and lexer is in C# (one of the targets) even though the default is Java.

你的问题很合适。我最近使用工具Antlr编写了一个DSL。 Antlr是一个解析器/词法分析器生成器。它允许轻松构建DSL(以及许多其他东西),当与StringTemplate(由同一个人编写)结合使用时,代码生成变得非常强大。它还可以针对多种语言。我们的解析器和词法分析器在C#(目标之一)中,即使默认值是Java。

One of the numerous benefits of Antlr are the descriptive error messages and the IDE/debugger (AntlrWorks) which allows you to step through your grammar and see the AST trees visually.

Antlr的众多优点之一是描述性错误消息和IDE /调试器(AntlrWorks),它允许您逐步查看语法并直观地查看AST树。

John Saunders suggested below the use of the built in visual studio DSL toolkit. Ultimately, I found those tools to be far to constricting. To require a GUI, without any ability to easily describe an underlying textual grammar, just seems inadequate for my needs.

John Saunders在下面建议使用内置的visual studio DSL工具包。最终,我发现这些工具远远不能收缩。要求GUI,没有任何能够轻松描述基础文本语法的能力,似乎不足以满足我的需求。

Along with the DSL parser/lexer I have also written a Visual Studio Language service, to provide intellisense, error highlighting, code completion and template items/projects.

除了DSL解析器/词法分析器,我还编写了一个Visual Studio语言服务,以提供智能感知,错误突出显示,代码完成和模板项目/项目。

Even if you dont implement the extras, a DSL can simplify repetitive work. My DSL specifically targets the CSLA framework, generating business objects easily with all the plumbing, allowing the developers to only worry about business logic.

即使你没有实现附加功能,DSL也可以简化重复性工作。我的DSL专门针对CSLA框架,使用所有管道轻松生成业务对象,允许开发人员只关心业务逻辑。

Here is a small example of the DSL:

以下是DSL的一个小例子:

datadef Object1Datadef
{

   tables
   {
      MyTable:PK[MyTableID], column1, column2;
   }

}

root MyObject
{
    datadef Object1Datadef;

    read "all";
    write "admin", "superusers";

    int _Myvariable;    

}

If your DSL allows you to describe your domain faster, more easily and increases productivity, then it is worthwhile.

如果您的DSL允许您更快,更轻松地描述您的域并提高生产力,那么这是值得的。

#5


I think the DSL most of us use most often is SQL, a little language for data manipulation and extraction.

我认为我们大多数人经常使用的DSL是SQL,一种用于数据操作和提取的小语言。

#6


Two recent uses of a DSL:

最近使用DSL的两个方面:

  1. Using the construct library - which basically defines a DSL for describing binary structures of data (such as file formats) and protocols.
  2. 使用构造库 - 它基本上定义了一个DSL,用于描述数据的二进制结构(如文件格式)和协议。

  3. Implementing a Python-based DSL for verifying hardware. This DSL lays out all the infrastructure required to write tests as "scenario functions" that can use the underlying DSL components.
  4. 实现基于Python的DSL以验证硬件。此DSL列出了将测试编写为可以使用底层DSL组件的“场景功能”所需的所有基础结构。

#7


Actually, you use DSLs almost everyday without knowing it... HTML, make, XML, latex and many many configuration languages...

实际上,你几乎每天都使用DSL而不知道它... HTML,make,XML,latex和许多配置语言......

I enjoy having a declarative DSL that generates a bunch of things...It feels good...

我喜欢使用声明式DSL生成一堆东西......感觉很好......

What is the impact of a DSL is an interesting but really difficult to assess... If your DSL is well designed for the targeted community (the targeted community is a really important point...) in terms of what this community is expecting and does well the job it is supposed to do, it's going to feel good...

DSL的影响是多么有趣但很难评估...如果你的DSL是针对目标社区设计的(目标社区是一个非常重要的一点......)就这个社区的期望而言做得好应该做的,感觉很好......

However, if you design a DSL without knowing the community or if they need to constantly fight with the limitations of the language (a DSL can still be turing-complete...), it's going to hurt...

但是,如果您在不了解社区的情况下设计DSL,或者他们是否需要经常与语言的限制作斗争(DSL仍然可以完成图片......),那将会受到伤害......

#8


In my experience, any software-engineering organization will create DSLs in response to repeated problems and too much template code being written. A short extract from my personal experience:

根据我的经验,任何软件工程组织都会创建DSL以响应重复的问题并编写太多的模板代码。从我的个人经历中摘录一下:

  • Compiler bottom-up rewrite-system generators
  • 编译器自下而上的重写系统生成器

  • Assembler generators
  • Object-code generators (implemented as a C++ library with operator overloading)
  • 对象代码生成器(实现为带有运算符重载的C ++库)

  • CPU simulator generator
  • CPU模拟器生成器

  • Simulator device model generator
  • 模拟器设备模型生成器

  • Command-line languages for interactive tools
  • 交互式工具的命令行语言

Also note that many file formats can be considered DSLs if you look closely.

另请注意,如果仔细观察,可以将许多文件格式视为DSL。

There was a good article by Mark Shapiro in ACM Queue a while back about this phenomenon too.

马克夏皮罗(Mark Shapiro)在ACM Queue上发表了一篇很好的文章。

Yet another example is the way in which users end up writing big programs in things not intended for it... like test benches using the old "SNIFF" debugger scripting language.

另一个例子是用户最终用不适合它的东西编写大型程序的方式......就像使用旧的“SNIFF”调试器脚本语言的测试台一样。

#9


This might be an old question, but the question in the title (rather than in the body) has not really been answered by anyone:

这可能是一个老问题,但标题中的问题(而不是在正文中)并没有真正被任何人回答:

There are two (dual) instances in which it makes sense to write a DSL:

有两个(双)实例,编写DSL是有意义的:

  • When the problem-domain is very well understood and has pre-existing vocabulary of nouns (objects), verbs (actions, combinators, etc) and adjectives (attributes, modifiers).
  • 当问题域被很好地理解并且具有名词(对象),动词(动作,组合器等)和形容词(属性,修饰符)的预先存在的词汇。

  • When the solution-domain is very well understood and ...
  • 当解决方案领域得到很好的理解并且......

Regular expressions are a good example of the first, while assembler-generators the second. General purpose programming language are there for the rest: when neither the problem-domain nor the solution-domain is that well understood, and so general tools have to be brought to bear.

正则表达式是第一个的好例子,而汇编程序生成器则是第二个。其他通用编程语言是存在的:当问题域和解决方案域都没有被很好地理解时,因此必须使用通用工具。

#10


How about BNF as a DSL for parser generators?

如何将BNF作为解析器生成器的DSL?

#11


DSLs created with the Visual Studio DSL Toolkit can be used to generate any text-based artifact from an instance of the domain model defined by the DSL. Of course, being inside of Visual Studio at the time, if there's a compiler or other processor for the text artifact, then it can automatically be run.

使用Visual Studio DSL Toolkit创建的DSL可用于从DSL定义的域模型的实例生成任何基于文本的工件。当然,当时在Visual Studio内部,如果有文件工件的编译器或其他处理器,那么它可以自动运行。

Some examples are

一些例子是

  • NORMA, a DSL for conceptual domain modeling, based on Object-Role Modeling notation (ORM2)
  • NORMA,用于概念域建模的DSL,基于对象角色建模表示法(ORM2)

  • Web Service Software Factory, which uses three DSLs to model web services
  • Web服务软件工厂,它使用三个DSL来建模Web服务

  • Configuration Section Designer - used to define the schema for XML configuration files and to generate the classes to expose the data from them.
  • 配置节设计器 - 用于定义XML配置文件的模式并生成类以从中公开数据。

And, of course, you can create your own.

当然,你可以创建自己的。

#12


I am still a student, but I am really fascinated with spirit

我还是学生,但我对精神很着迷

I've used it little bit throughout my 'programming languages' course. This is how it works, basically you are writing EBNF.

我在“编程语言”课程中使用了一点点。这是它的工作原理,基本上你是在写EBNF。

alt text http://img6.imageshack.us/img6/1461/reala.png

替代文字http://img6.imageshack.us/img6/1461/reala.png

becomes this in C++ ;)

在C ++中成为这个;)

alt text http://img6.imageshack.us/img6/8809/dsl.png

替代文字http://img6.imageshack.us/img6/8809/dsl.png