Java / Abstract Syntax Tree into XML representation

后端 未结 2 2055
半阙折子戏
半阙折子戏 2021-01-14 20:28

do you know of any tool which creates an AST from a Java program or class and creates an XML representation (Collection or single XML document) from the AST?

kind re

2条回答
  •  春和景丽
    2021-01-14 20:32

    Not any tools directly, but http://www.antlr.org/ is the defacto tool for building ASTs from any general language. And there exists several grammar files for Java that you can repurpose for your own programs. So grab ANTLR, use the latest Java grammer, and write out the XML representation you want.

提交回复
热议问题