Re: C++ intermediate representation.

"Aaron Gray" <angray@beeb.net>
13 May 2005 18:01:45 -0400

          From comp.compilers

Related articles
C++ intermediate representation. shakti.misra@wipro.com (DeltaOne) (2005-05-05)
Re: C++ intermediate representation. angray@beeb.net (Aaron Gray) (2005-05-13)
Re: C++ intermediate representation. cfc@shell01.TheWorld.com (Chris F Clark) (2005-05-14)
Re: C++ intermediate representation. henry@spsystems.net (2005-05-14)
Re: C++ intermediate representation. angray@beeb.net (Aaron Gray) (2005-05-14)
Re: C++ intermediate representation. ralphpboland@yahoo.com (Ralph Boland) (2005-05-14)
Re: C++ intermediate representation. cfc@shell01.TheWorld.com (Chris F Clark) (2005-05-14)
Re: C++ intermediate representation. gsc@zip.com.au (Sean Case) (2005-05-14)
[10 later articles]
| List of all articles for this month |

From: "Aaron Gray" <angray@beeb.net>
Newsgroups: comp.compilers
Date: 13 May 2005 18:01:45 -0400
Organization: Compilers Central
References: 05-05-023
Keywords: C++

> I am willing to write a program that gives the intermediate
> representation of a C++ program. This program is intended to clarify
> the "under the hood" things of c++. It will give a few comments also
> on what is what,like virtual functions,inline functions.
>
> The input to the program will be a C++ source file and the output will
> be unoptimised intermediate representation. I will be assuming in the
> initial stage that the source file contains correct syntax. I think
> this kind of program should be there for people to help learn
> compilers more.
>
> Can any one help me in this issue. Either by giving me some book
> reference or telling me how to do it.


So you want to write a C++ Lint ?


Parsing C++ properly is no mean feat. C++'s grammar is ambiguous, as
well as the basic type/identifier ambiguity C has, C++ has its own
ambiguities. The new GCC's 3.4.x and 4.0 both use recursive descent
with backtracking parser technology rather than LALR(1) or Generalized
LR.


The Elsa project, Elkhound's (a GLR parser generator) seems to have gotten
stuck with parsing STL.


                http://www.cs.berkeley.edu/~smcpeak/elkhound/


Recursive descent with backtracking may well be the simplest solution.


> ~Thanks and Regards
> [Different compilers have different internal representations,
> depending on both what the compiler does, e.g., what kinds of analysis
> and optimization, and the taste of the people who wrote the compiler.
> -John]


The internal semantic representation is yet another equally complex problem.


Aaron


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.