使用 DLR(主要)进行静态语言编译

发布于 2024-07-06 05:43:48 字数 329 浏览 6 评论 0原文

我正在构建一个针对 .NET 的编译器,并且之前已经直接生成了 CIL,但是生成 DLR 树将使我的生活变得更加轻松。 我支持一些动态功能,即运行时函数创建和鸭子类型,但绝大多数代码是完全静态的。

既然已经解释过了,我有以下问题:

  • 除了 MSDN 博客上的小示例之外,DLR 是否已用于静态编译?
  • 如果是的话,取得了什么样的表现?
  • 如果不是,有什么从根本上阻止这种情况发生吗?
  • 是否有比使用 DLR 或直接发出 IL 更好的生成代码机制?

对此的任何见解或对博客/代码/演讲的引用将不胜感激。

I'm building a compiler that targets .NET and I've previously generated CIL directly, but generating DLR trees will make my life a fair amount easier. I'm supporting a few dynamic features, namely runtime function creation and ducktyping, but the vast majority of the code is completely static.

So now that that's been explained, I have the following questions:

  • Has the DLR been used for static compilation, outside of small examples on MSDN blogs?
  • If so, what sort of performance was achieved?
  • If not, is there anything fundamentally preventing this?
  • Are there any better mechanisms of generating code than either using the DLR or emitting IL directly?

Any insight into this or references to blogs/code/talks would be greatly appreciated.

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

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

发布评论

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

评论(1

晨曦慕雪 2024-07-13 05:43:48

我还不知道有人以这种方式使用 DLR,尽管这绝对是它的预期用例之一。 需要考虑的一件有趣的事情是,DLR 的表达式树已与 LINQ 表达式树合并,因此在某些尚未公布的 Visual Studio 未来版本中为 LINQ 生成的 IL 将使用 DLR 代码。

将 DLR 作为开源发布的一个好处是,我们不知道公司外部的人可能会用它做什么样的有趣的事情:)。

I'm not aware of anyone using the DLR in quite this fashion yet, though this is definitely one of its intended use cases. One interesting thing to consider is that the DLR's expression trees have been merged with LINQ expression trees, so the IL being produced for LINQ in some as-yet-unannounced future version of Visual Studio will be using the DLR code.

A neat aspect of releasing the DLR as open source is that we have no idea what kinds of interesting things people outside the company might be doing with it :).

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