<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Mar 5, 2013, at 2:41 AM, Matthias Grimmer <<a href="mailto:grimmer@ssw.jku.at">grimmer@ssw.jku.at</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Hi<br><br>we are using clang and its -ast-dump-xml feature. Our goal is to convert the serialized clang-AST to a different code representation.<br>We think that the output, that -ast-dump-xml produces, is not well suited for parsing. Statements are represented as ASCII styled trees and also contain parts that<br>confuse XML parsers (e.g. <line:18:2, col:18>).<br></div></blockquote><div><br></div>The pseudo-XML dump is a debugging aid. It's not a stable, useful format on which to build tools. Tools should be built on top of the Clang AST, either through libclang (for a stable but not-very-rich AST representation) or the C++ AST.</div><div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Is there a better way to get a serialized version of the clang AST (XML, or any other format that is easier to parse)?<br></div></blockquote><div><br></div>No, there isn't.</div><div><br><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">We would like to avoid writing a clang AST visitor for this purpose.<br></div></blockquote></div><div><br></div>Writing a Clang AST visitor or libclang client is really the best way to do this. There is no way to get sufficient information out of the debugging dumps to build a tool, unless your goal is to build a simple toy example that handles only a small part of C(++).<div><br><div><span class="Apple-tab-span" style="white-space:pre">   </span>- Doug</div><div><br></div></div></body></html>