Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在研究一种新的玩具语言,它将被静态编译为 .NET 的 IL 代码。
我可以想到以下方法来实际生成 IL,但我对替代方案持开放态度:
还有通用编译器基础结构(AST/Code、元数据),当然还有古老的 Reflection.Emit。我自己对 CCI 没有任何经验,但这个页面似乎是 IL 翻译方面的一个很好的起点。
您可以使用此编译器生成器编写自己的语言。我用过。它真的很容易使用和理解。
可可/R
http://en.wikipedia.org/wiki/Coco/R
如果 MSIL 生成本身不是本质,您可以将您的语言“编译”(翻译)为 C#,然后使用常规的 dotnet 编译器。我想这很容易做到,尽管你没有足够的空间来实现深奥的性能优化等等。在我不关心优化编译速度的任何新语言情况下,翻译成通用高级语言肯定是我的首选。