How to convert source code to a xml based representation of the ast?

前端 未结 5 1454
囚心锁ツ
囚心锁ツ 2021-02-06 07:51

i wanna get a xml representation of the ast of java and c code. 3 months ago, i asked this question yet but the solutions weren\'t comfortable for me

  • srcml seems t
5条回答
  •  情歌与酒
    2021-02-06 08:25

    Only for Java, you can use BeautyJ.

    You can launch it against your file with -xml.* options. For example:

    java /your/dir/BeautyJ/lib/beautyj.jar beautyj -xml.out= -xml.doctype your_file.java
    

    ...and you get an XML representation of that file (and included ones).

    BTW: the "-xml.out=" options specify an output file. Used in that way, with the trailing "=", it output to STDOUT. It's not an error.

提交回复
热议问题