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

autobiographer picture autobiographer · May 12, 2010 · Viewed 8.1k times · Source

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 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.

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: 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.

Answer

Veni_Vidi_Vici picture Veni_Vidi_Vici · Aug 13, 2012

a bit late but here is one: http://xmltranslator.appspot.com/sourcecodetoxml.html

I have implemented it myself and it converts PHP and Java to XML. It's free so enjoy!

Oana.