This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: A FrontEnd in C++?
- From: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- To: khalid aggag <khalidaggag at hotmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 19 Aug 2002 17:46:18 +1000
- Subject: Re: A FrontEnd in C++?
- References: <F37crCgXAC98D6B8MK9000097e3@hotmail.com>
On 17-Aug-2002, khalid aggag <khalidaggag@hotmail.com> wrote:
> I am currently developing a new Frontend for an educational language for
> GCC. I have the language's lexical analysis and parsing modules in C++. Is
> it possible to develop a frontend for gcc written completely in C++?
Yes, it is possible.
People have written frontends for gcc in languages other than C before.
For example, the Ada front-end is written in Ada, and the Mercury
front-end is written in Mercury. These both include a small amount
of C code to interface with the GCC back-end, but if you're writing
in C++ you should be able to avoid that. You might need to make
some minor modifications to the GCC header files, though.
> How
> would I make up for the different function naming and calling conventions
> between C and C++? Thanx alot in advance.
Use `extern "C"', either in the C++ code, e.g.
extern "C" {
#include "tree.h"
}
or by modifying the GCC headers, e.g.
/* tree.h */
#ifdef __cplusplus
extern "C" {
#endif
... body of tree.h goes here
#ifdef __cplusplus
}
#endif
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.