Hi, I know most compilers go from AST to CFG. I am writing a decompiler, so I was wondering if anyone knew of any documents describing how best to get from CFG to AST. The decompiler project is open source. https://github.com/jcdutton/libbeauty
The decompiler already contains a disassembler and a virtual machine resulting in an annotated CFG. It uses information gained from using a virtual machine to annotate the CFG. Another use of the VM will be to help analyze self modifying code. The decompiler can output C source code form the CFG, but it is not easy to understand the result due to lack of structure such as for {} loops. I wish to create an AST from the CFG in order to be able to output for {}, while {} and if...then...else structure. The CFG to AST step seems a little complicated, so I was looking for some pointers to how best to do it to save me re-inventing the wheel. Kind Regards James