Code Comments
Programming Forum and web based access to our favorite programming groups.Hello, I need to capture an intermediate representation for C++ in order to take measurements on the code. I was thinking of hacking gcc in order to capture the abstract synthatic tree (AST) it is building. So I was asking myself: 1) do gcc produce an AST? 2) can I capture it? thanks in advance for your replies, Gregory Seront
Post Follow-up to this messagegs@cetic.be (Gregory Seront) wrote in message news:<04-09-099@comp.compilers>... > Hello, > > I need to capture an intermediate representation for C++ in order to > take measurements on the code. > I was thinking of hacking gcc in order to capture the abstract > synthatic tree (AST) it is building. > So I was asking myself: > > 1) do gcc produce an AST? > 2) can I capture it? 1) From GCC 4.0 (ie. CVS HEAD) onwards, yes it does. 2) Yes you can, GCC has options to dump the AST after every optimization pass. Whether the dump is good enough for you depends on what measurements you want to do. The dumps are not self contained nor compilable. Gr. Steven
Post Follow-up to this messageOn Tue, 14 Sep 2004 16:37:12 -0400, Gregory Seront wrote: Gregory wrote: [snip] > > 1) do gcc produce an AST? yes it does. > 2) can I capture it? yes you can. Take a look at the man page for gcc especially the following flags: -fdump-translation-unit -fdump-tree-switch Hope this helps, George
Post Follow-up to this messageHello, ANTLR (www.antlr.org) is a compilers tool that constructs AST. And a c++ grammar is available to download. ANTLR constucts descendent parsers and can generate code for JAva,C++ and C# Possibly it can helps you. Cheers, On 14 Sep 2004 16:37:12 -0400, Gregory Seront <gs@cetic.be> wrote: > Hello, > > I need to capture an intermediate representation for C++ in order to > take measurements on the code. -- Joan Jesús Pujol Espinar
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.