This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: reproducing C source code from gcc parse tree?
- To: gcc at gcc dot gnu dot org
- Subject: Re: reproducing C source code from gcc parse tree?
- From: "Alexandre E. Kopilovitch" <aek at vib dot usr dot pu dot ru>
- Date: Tue, 9 Oct 1 19:31:58 +0400
- Cc: dennis at research dot bell-labs dot com, dnovillo at redhat dot com
- Organization: h w c employees, b f
On Mon, 8 Oct 2001 19:52:14 -0400 Diego Novillo wrote:
>On Mon, 08 Oct 2001, Dennis Dams wrote:
>
>> Hi,
>>
>> Is there any functionality in gcc that allows to reproduce C source
>> code from a parse tree (i.e. from the tree representation as defined
>> in tree.h)?
>>
>Nope. It shouldn't be too hard, though.
I can confirm that, at least partially - for the C++ classes and the method
declarations within them - I have done that work for sufficiently big and complex
collection of the classes, using gcc 3.0 . But I warn you that if you are going
to play with the attributes, then you may meet several annoying errors in gcc,
some of them are hard to locate and fix (not being accustomed with the gcc).
And I didn't deal with the expressions (except of trivial cases in the default
values for the parameters) and the templates.
The documentation (chapter "Trees" in the gcc manual) gives a more or less
suitable starting point, but in many cases you should find a proper macro yourself
(and yes, you may expect that it exists somewhere in tree.h ).
Alexander Kopilovitch aek@vib.usr.pu.ru
Saint-Petersburg
Russia