Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

AST capture in gcc
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

Report this thread to moderator Post Follow-up to this message
Old Post
Gregory Seront
09-15-04 01:58 AM


Re: AST capture in gcc
gs@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

Report this thread to moderator Post Follow-up to this message
Old Post
Steven Bosscher
09-22-04 08:59 AM


Re: AST capture in gcc
On 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

Report this thread to moderator Post Follow-up to this message
Old Post
George Huber
09-22-04 08:59 AM


Re: AST capture in gcc
Hello,

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

Report this thread to moderator Post Follow-up to this message
Old Post
Joan Pujol
09-22-04 08:59 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Compilers archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:10 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.