将 Scala AST 转换为源代码
给定一个 Scala AST,有没有办法生成 Scala 源代码?
我正在研究通过解析/分析其他 Scala 源代码来自动生成 Scala 源代码的方法。任何提示将不胜感激!
Given a Scala AST, is there a way to generate Scala source code?
I'm looking into ways to autogenerate Scala source by parsing/analyzing other Scala source. Any tips would be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅我们的 DMS 软件重组工具包。
DMS 提供了一个完整的生态系统,用于解析/分析/优化/转换多种语言的源代码。它通过为这些任务提供通用机制作为其核心功能,并根据明确提供的语言定义(“前端”)专门化这些任务来实现这一目标。 DMS 拥有许多已被广泛使用的语言(C、C++、C#、Java、COBOL...)的前端,以及快速定义其他语言的过程。
我们或多或少地致力于不断扩展语言集。 DMS 已经实现了部分 Scala 前端,并且我们知道如何基于我们构建的其他 30 多个前端来完成它,特别强调 Java 知识。
See our DMS Software Reengineering Toolkit.
DMS provides a complete ecosystem for parsing/analyzing/optimizing/transforming source code in many languages. It achieves this by provide generic machinery for these tasks as its core capabilities, and specializing those according to explicitly supplied language definitions ("front ends"). DMS has front ends for many languages (C, C++, C#, Java, COBOL, ...) that have been used in anger, and a process for defining others very quickly.
We work on expanding the language set more or less continuously. DMS already has parts of a Scala front end implemented, and we know how to finish it based on the other 30+ front ends we have built, with special emphasis on knowledge of Java.
我已成功使用 Mirko Stocker 的 Scala-Refactoring 来完成此任务。
对于综合构建 AST,它强烈依赖于现有的 Scala NSC 的树 DSL。
虽然代码有点乱,但是你可以在我的项目ScalaCollider-UGens中找到示例用法。
我还遇到了一个非常有用的类 约翰内斯·鲁道夫。
I have been successfully using Scala-Refactoring by Mirko Stocker for this task.
For synthetically constructing ASTs, it relies strongly on the existing Tree DSL of Scala's NSC.
Although the code is a bit messy, you can find an example usage in my project ScalaCollider-UGens.
I have also come across a very useful class by Johannes Rudolph.