开发者

Java (or bytecode) AST generators available so that I can run a couple of Visitors on top of its result?

I am looking for a tool that'll take either a .java source code file, or .class or .jar and parses it, generating an AST(abstract syntax tree), so I can play with it. I intend to create a couple of Visitors to run on top of it.

Do such tools exist in Java? There exists something similar in .NET, called Mono.Cecil (although it seems that as of today, it's not supporting the Visitor pattern by itself).

开发者_如何学编程

Thanks


You might be interested in the ASTParser used by the Eclipse IDE. Here is a nice article on getting started with it.


Our DMS Software Reengineering Toolkit is general purpose compiler machinery with support for parsing, building ASTs, buiding symbol tables, walking/inspecting/modifying the ASTs, and prettyprinting a modified AST back to source code. It also provides for pattern matching with the patterns written in the surface syntax of the target language as defined by the parser it uses. DMS also provides generaic facilities for computing control and data flow, as well as call graphs. DMS provides a complete ecosystem to support the construction of arbitrary analyzers, code transformers, or generators, depending on your needs.

DMS has an optional Java Front End which enables DMS to provide all this capability for processing Java and .class files.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜