Hello,<br><br>Yours is a very interesting problem. I am also interested in this, hope someone can answer.<br><br><div class="gmail_quote">On Thu, Sep 13, 2012 at 4:58 AM, James Courtier-Dutton <span dir="ltr"><<a href="mailto:james.dutton@gmail.com" target="_blank">james.dutton@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I know most compilers go from AST to CFG.<br>
I am writing a decompiler, so I was wondering if anyone knew of any<br>
documents describing how best to get from CFG to AST.<br>
The decompiler project is open source.<br>
<a href="https://github.com/jcdutton/libbeauty" target="_blank">https://github.com/jcdutton/libbeauty</a><br>
<br>
The decompiler already contains a disassembler and a virtual machine<br>
resulting in an annotated CFG. It uses information gained from using a<br>
virtual machine to annotate the CFG. Another use of the VM will be to<br>
help analyze self modifying code.<br>
<br>
The decompiler can output C source code form the CFG, but it is not<br>
easy to understand the result due to lack of structure such as for {}<br>
loops.<br>
I wish to create an AST from the CFG in order to be able to output for<br>
{}, while {}  and if...then...else structure.<br>
The CFG to AST step seems a little complicated, so I was looking for<br>
some pointers to how best to do it to save me re-inventing the wheel.<br>
<br>
Kind Regards<br>
<br>
James<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>[Carolina Simões Gomes]<br>M.Sc. Student in Computing Science<br>University of Alberta, Canada<div>CAS Partner - IBM Toronto<br>+1 (780) 863-0155<br><br></div><br>