如何将源代码转换为基于 xml 的 ast 表示? [英] How to convert source code to a xml based representation of the ast?

查看:35
本文介绍了如何将源代码转换为基于 xml 的 ast 表示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获得 java 和 c 代码的 ast 的 xml 表示.3 个月前,我问了这个问题,但这些解决方案对我来说并不舒服>

  • srcml 似乎是这个问题的一个很好的解决方案,但它不支持行数字和列,但我需要那个功能.
  • 关于 elsa:引用:正在努力将 Elsa AST 导出为 XML 文档;我们希望能够在下一次公开发布中宣传这一点."
  • dms... 不明白这一点.
  • 特别是对于 Java,有 javaml 支持行号.但 sourceforge 页面 没有列出任何文件.

问题:是否有支持将 ast 转换为支持行号(和列)的 xml 的软件[特别是对于 java 和 c/c++]?有没有 javaml 和 srcml 的替代方案?

ps:我不想拥有解析器生成器.我希望找到一个可以在控制台输入的工具:./my-xml-generator Test.java [或类似的东西]...或者java实现也会很棒.

解决方案

有点晚了,但这里有一个:http://xmltranslator.appspot.com/sourcecodetoxml.html

我自己实现了它,它将 PHP 和 Java 转换为 XML.它是免费的,尽情享受吧!

奥娜.

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.

解决方案

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.

这篇关于如何将源代码转换为基于 xml 的 ast 表示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆