我想知道是否有类似的事情来 GCC_XML 对C#3;基本的方式来重新present程序的整个句法结构的XML。
I was wondering if there is something similar to GCC_XML for C#3; basically a way to represent a program's entire syntactic structure in XML.
在重新presentation创建,我希望能够解析为一个XDocument和跨preT或从那里查询。
Once the representation is created, I was hoping to parse it into an XDocument and interpret or query it from there.
是否有工具,有这个?
我们的 DMS软件再造工具包可以用C#2/3/4 做到这一点。 (编辑2014年:现在C#5)
Our DMS Software Reengineering Toolkit can do this with C# 2/3/4. (EDIT 2014: and now C# 5)
DMS有编译器准确解析器的C#(以及Java和许多其他语言)。
DMS has compiler accurate parsers for C# (as well as Java and many other languages).
它会自动生成完整的抽象语法树不管它解析。每个AST节点加盖文件/行/列的重新启动该节点的presents令牌, 而最后一列可以通过DMS API调用来计算。它高度评价树节点,所以它们不会丢失。 DMS还可以再生有效code从AST,或由改性的AST;这使得它能够被用于code修改或代
It automatically builds full Abstract Syntax Trees for whatever it parses. Each AST node is stamped with file/line/column for the token that represents that start of that node, and the final column can be computed by a DMS API call. It attaches comments to tree nodes so they aren't lost. DMS can also regenerate valid code from the AST, or from a modified AST; this enables it to be used for code modification or generation.
它有一个内置的选项生成XML从AST的,完整的节点类型,源位置(如上),以及任何相关的文本值。命令行调用是:
It has a built-in option to generate XML from the ASTs, complete with node type, source position (as above), and any associated literal value. The command line call is:
run DMSDomainParser ++XML <path_to_your_file>
DMS本身提供的基础设施大量用于操纵它构建的AST: 遍历,模式匹配(针对模式$ C $以源代码形式基本上是CD),源到源转换。
DMS itself provides a vast amount of infrastructure for manipulating the ASTs it builds: traversing, pattern matching (against patterns coded essentially in source form), source-to-source transforms.
它具有控制流,数据流,指向的分析,全球调用图的C,COBOL和Java;这是所有未来的C#。
It has control flow, data flow, points-to analysis, global call graphs for C, COBOL and Java; that's all coming for C#.
DMS被设计成一个的多的比XML用于操纵例如code更好的解决方案。
DMS was designed to be a much better solution than XML for manipulating such code.