开发者

What would you use to build a new compiler for .NET?

I'm working on a new toy language that will be statically compiled to .NET's IL code.

Off hand I can think of the following to actually generate the 开发者_JAVA技巧IL, but I'm open to alternatives:

  • Cecil
  • ILASM


There is also the Common Compiler Infrastructure (AST/Code, Metadata), and of course the venerable Reflection.Emit. I don't have any experience of CCI myself, but this page seems a good starting point for the IL translation side of things.


You can write your own language using this compiler generator. I used it. Its really easy to use and to understand.

CoCo/R

http://en.wikipedia.org/wiki/Coco/R


if MSIL generation per se is not of the essence, you could "compile" (translate) your language to C# and then use the regular dotnet compiler for that. I would imagine that's quite a bit easier to do, although you don't get as much scope for implementing esoteric performance optimizations and so on. Translation into a common high level language would have definitely been my first choice in any such new language situation where I was not concerned with optimizing the speed of compilation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜