[英]Generate and parse Python code from C# application
I need to generate Python code to be more specific IronPyton . 我需要生成Python代码以更具体的IronPyton 。 I also need to be able to parse the code and to load it into AST . 我还需要能够解析代码并将其加载到AST中 。 I just started looking at some tools. 我刚开始看一些工具。 I played with "Oslo" and made a decision that it's not the right tool for me. 我和“奥斯陆”一起玩,并决定它不适合我。 I just looked very briefly at Coco/R and it looks promising. 我只是简单地看了一下Coco / R ,看起来很有前途。
Does anyone use Coco/R? 有没有人使用Coco / R? If you did what's your experience with the tool Can you recommend some other tool? 如果你使用该工具做了什么经验你能推荐一些其他工具吗?
IronPython实现本身包括一个解析器和一个 Python程序的AST表示 ,可以使用PythonWalker
。
I think you should look at the Dynamic Language Runtime . 我认为你应该看看动态语言运行时 。 This will be a standard part of some later version of .Net and C# (.Net 4 from memory). 这将是.Net和C#(内存中的.Net 4)的某些更高版本的标准部分。
I've used it to compile and execute Python code generated at runtime, but I haven't played with all the AST stuff yet. 我已经用它来编译和执行在运行时生成的Python代码,但我还没有玩过所有AST的东西。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.