如何将源代码转换为基于ast的xml的表示形式? [英] How to convert source code to a xml based representation of the ast?
问题描述
我想获取Java和C代码的ast的xml表示形式。 3个月前,我问了这个问题,但是解决方案对我来说并不令人满意
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 似乎是解决此问题的好方法,但它不支持行号和列,但我需要该功能。
- 关于 elsa :引用:我们正在努力将Elsa AST导出为XML文档;我们希望能够在下一个公开发行中对此做广告。
- dms ...没有
- 尤其是对于Java,有 javaml 支持行号。但是 sourceforge页未列出任何文件。
- srcml seems to be a good solution for this problem but it does not support line numbers and columns but i need that feature.
- about elsa: cite: "There is ongoing effort to export the Elsa AST as an XML document; we expect to be able to advertise this in the next public release."
- dms... didn't understand that.
- especially for java, there is javaml which supports line numbers. but the sourceforge page doesn't list any files.
问题:有可用的软件支持将ast转换为xml,该行支持行号(和列)[特别是对于Java和c / c ++]?
question: there's software available which supports conversion of ast into xml which supports line numbers (and columns) [especially for java and c/c++]? is there an alternative to javaml and srcml?
ps:我不想要解析器生成器。我希望找到一个可以在控制台上键入以下内容的工具:./my-xml-generator Test.java [或类似的东西] ...或者Java实现也将是很好的。
ps: i don't wanne have parser generators. i hope to find a tool which can be used on the console typing: ./my-xml-generator Test.java [or something like that]... or a java implementation would be great too.
推荐答案
有点晚,但这是一个:
http://xmltranslator.appspot.com/sourcecodetoxml.html
a bit late but here is one: http://xmltranslator.appspot.com/sourcecodetoxml.html
我自己实现了它,并将PHP和Java转换为XML 。
它是免费的,所以享受吧!
I have implemented it myself and it converts PHP and Java to XML. It's free so enjoy!
Oana。
这篇关于如何将源代码转换为基于ast的xml的表示形式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!