Convert Scala AST to Source

Given the Scala AST, is there a way to generate Scala source code?

I am exploring ways to auto-generate a Scala source by analyzing / analyzing another Scala source. Any advice would be appreciated!

+5
scala abstract-syntax-tree
source share
2 answers

I have successfully used the Scala-Refactoring Mirko Stocker for this task.

For the synthetic construction of AST, he relies heavily on the existing DSL of the Scala NSC tree .

Although the code is a bit messy, you can find an example of using ScalaCollider-UGens in my project.

I also met a very useful class Johannes Rudolph .

+6
source share

See our DMS Software Reengineering Toolkit .

DMS provides a complete ecosystem for parsing / analyzing / optimizing / converting source code in many languages. He accomplishes this by providing a common mechanism for these tasks as core capabilities and specializing them in explicitly defined language definitions ("front end"). DMS has leading edges for many languages ​​(C, C ++, C #, Java, COBOL, ...) that were used in anger, and the process of identifying others is very fast.

We are working on expanding the language set more or less continuously. The DMS already has parts of the Scala interface, and we know how to end it based on the other 30+ fronts we created, with particular emphasis on knowledge of Java.

0
source share

All Articles