将内部 DSL 转换为外部 DSL 是反模式吗?

发布于 2024-07-06 17:36:41 字数 210 浏览 7 评论 0原文

在我们的遗留系统中,我们编写了自己的 VM 来在运行时执行我们的内部 DSL。 内部 VM 设计为仅运行我们的内部 DSL。 我们正在重写我们的遗留应用程序。 我们正在考虑的想法之一是将内部 DSL 转换为外部 DSL(C# 或 Java)并利用它们的 VM。

何时为内部 DSL 编写我们自己的 VM,以及何时转换为外部 DSL 并在该 VM 上运行,没有明确的指导方针。

In our legacy system, we wrote our own VM to execute our internal DSL at run time. The in-house VM was designed to run our internal DSL only. We are in the process of rewriting our legacy application. One of the idea we are considering is, to transform our internal DSL to external DSL (C# or Java) and take advantage of their VM.

There are no clear guide lines when to write our own VM for our intenral DSL vs. transforming to external DSL and running it that VM.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

岁月蹉跎了容颜 2024-07-13 17:36:41

内部 DSL/VM 与外部 DSL/VM 决策与所有构建、购买与下载决策相同。 该指南对于所有软件来说都是清晰且相同的。

当其他人为您支持 Java 或 Python 时,为什么还要支持您自己的 VM?

这里有一些明确的指导方针。 请注意,这些对于所有软件都是相同的准则。

  1. 继续维护自己的软件对您来说是否更便宜? 在这种情况下,DSL 和 VM?

  2. 您自己的 DSL 和 VM 比 Java 或 Python 更好吗? 通过“更好”,您必须填写质量因素的任意组合:更快、更小、更可靠、更好的功能、更少的资源使用、更可审计、更安全等。

不要与 DSL 和 VM 混淆。 没什么特别的; 这只是更多的软件。

The internal DSL/VM vs. external DSL/VM decision is the same as all build vs. buy vs. download decisions. The guidelines are clear and the same for all software.

Why support your own VM, when someone else will support Java or Python for you?

Here's some clear guidelines. Note that these are the same guidelines for all software.

  1. Is it cheaper for you to continue to maintain your own software. In this case, DSL and VM?

  2. Is your own DSL and VM better than Java or Python? By "better", you must fill in any combination of quality factors: faster, smaller, more reliable, better features, less resource use, more auditable, more secure, etc.

Don't be confused by DSL and VM. It's nothing special; it's just more software.

ぃ弥猫深巷。 2024-07-13 17:36:41

这绝对不是一种反模式。 与内部 DSL 相比,外部 DSL 有许多优点。 在您的情况下,独立于宿主语言或实现平台就是其中之一。 其他好处是更好的语法灵活性、使用模型驱动方法(如模型转换、模型查看等)的可能性。

It is definitely not an anti-pattern. External DSLs have many advantages compared to the internal ones. Independence from the host language or implementation platform in your case is one of them. Other benefits are better syntax flexibility, possibility to use model driven approches like model transformations, model viewing and others.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文