您写DSL遇到什么样的问题? [英] For what kind of problems do you write a DSL?

查看:83
本文介绍了您写DSL遇到什么样的问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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进行一些具体的投入.

So I come to SO to have some concrete input.

您曾经使用过DSL吗?写一个.如果是,感觉如何?

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. 不包括Tex,HTML,Make和SQL.实际上,问题更多是:编写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"

推荐答案

我是从事 NUnit 2.0版及更高版本.它是使用C#属性编写的DSL,用于描述单元测试.它不是DSL最明显的例子,但我已经将其视为一个例子. 我使用ANTLR甚至MGrammar编写了其他一些文章.经验通常是相同的.一旦将其展示给其他人,他们就会想做一堆您从未想到的事情.很好,但是您必须做好准备并添加功能.

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.

我现在习惯于经常思考和编写DSL.我当前使用的对象关系映射器是dsl.这不是一种新语言.它是纯C#,但是考虑到域的语言,并且该域不仅仅是业务域,我们创建了一种迷你语言来映射对象.关于DSL的思考改变了我们的API和框架构建方法.

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遇到什么样的问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆