This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [OT] Control Flow Graph(CFG) into Abstract Syntax Tree(AST)


thanks for sharing, will check this out.
mike

On Fri, Sep 14, 2012 at 9:05 PM, James Courtier-Dutton
<james.dutton@gmail.com> wrote:
> 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



-- 
James Michael DuPont
Member of Free Libre Open Source Software Kosova http://flossk.org
Saving wikipedia(tm) articles from deletion http://SpeedyDeletion.wikia.com
Contributor FOSM, the CC-BY-SA map of the world http://fosm.org
Mozilla Rep https://reps.mozilla.org/u/h4ck3rm1k3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]