<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">No, the goal is definitely not to built
      a toy example.<br>
      We have to be able to process all real life C applications, and
      therefore serialize all information that is necessary.<br>
      Can you recommend the ASTDumper.cpp / -ast-dump as a good
      reference implementation? It seams that ASTDumper.cpp / -ast-dump
      does pretty much what we want, except from the output format.
      <br>
      <br>
      Thanks in advance<br>
      <br>
      - Matthias<br>
      <br>
      On 03/06/2013 04:24 PM, Manuel Klimek wrote:<br>
    </div>
    <blockquote
cite="mid:CAOsfVv=jqNp04YjM6L9UztO63Jkb3tgGNWfj8LpkGnBXxnaMeQ@mail.gmail.com"
      type="cite">
      <div dir="ltr">On Wed, Mar 6, 2013 at 7:14 AM, Douglas Gregor <span
          dir="ltr"><<a moz-do-not-send="true"
            href="mailto:dgregor@apple.com" target="_blank">dgregor@apple.com</a>></span>
        wrote:<br>
        <div class="gmail_extra">
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div style="word-wrap:break-word"><br>
                <div>
                  <div class="im">
                    <div>On Mar 5, 2013, at 2:41 AM, Matthias Grimmer
                      <<a moz-do-not-send="true"
                        href="mailto:grimmer@ssw.jku.at" target="_blank">grimmer@ssw.jku.at</a>>
                      wrote:</div>
                    <br>
                    <blockquote type="cite">
                      <div
style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing: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>
                  </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>
            </blockquote>
            <div><br>
            </div>
            <div style="">Wasn't there a plan to get rid of the XMLish
              dump?</div>
            <div style=""><br>
            </div>
            <div style="">Cheers,</div>
            <div style="">/Manuel</div>
            <div style=""> <br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div style="word-wrap:break-word">
                <div>
                  <div class="im"><br>
                    <blockquote type="cite">
                      <div
style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing: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>
                  </div>
                  No, there isn't.</div>
                <div class="im">
                  <div><br>
                    <blockquote type="cite">
                      <div
style="letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">We
                        would like to avoid writing a clang AST visitor
                        for this purpose.<br>
                      </div>
                    </blockquote>
                  </div>
                  <div><br>
                  </div>
                </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 style="white-space:pre-wrap"> </span>-
                    Doug</div>
                  <div><br>
                  </div>
                </div>
              </div>
              <br>
              _______________________________________________<br>
              cfe-dev mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
              <a moz-do-not-send="true"
                href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev"
                target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
              <br>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>