views:

339

answers:

7

i know it sounds crazy but, i just want to ask if is a compiler support multi programming language? like Delphi could also support C/C++/C# etc? if there is, please let me know. or how?

+8  A: 

The GNU Compiler Collection includes front ends for C, C++, Objective-C, Fortran, Java, and Ada

http://gcc.gnu.org/

qrdl
It's called compiler collection and it's still a single compiler?
sumek
GCC is a bunch of binaries - front-ends, preprocessor, compiler and driver. You, as a user, only communicate with the driver, and it figures out the language (based on source file extension) and invokes appropriate front-end
qrdl
+1  A: 

.net support multi-language programming (vc++, c#, vb, etc.)

mitsky
But using one compiler per language, so that's not quite the same thing.
Andrew McGregor
+3  A: 

Clang does C, C++ and Objective C.

Andrew McGregor
Since both C++ and Objective-C are (non-strict) superset of C and C++ and ObjC can be mixed together (ObjC++), I consider it be only 1 language.
KennyTM
Hmm... but the semantics of C++ are very different. It has to be a pretty flexible compiler to do that.
Andrew McGregor
+5  A: 

С++ Builder's projects can have both C++ and Pascal (Delphi) code in the same project. Just add existing or create a new .pas-file to C++ project. It will be compiled by C++ Builder (like it was C++ code).

The opposite is not true: Delphi can not compile C++ code.

Alexander
+1  A: 

GCC can be considered as unique compiler even though indeed it's made of several binaries... but you can call it always as gcc and supports C, C++, Objective-C and few more (a lot more indeed, theoretically: one language per available front-end). At the beginning gcc meant GNU C Compiler, but then started to support more languages and the acronym became GNU Compiler Collection.

ShinTakezou
+3  A: 

Borland Rad Studio 2007 does C#, Delphi.NET, C++ (and with that also the C subset) and Delphi.

In later iterations, .NET support was abandoned.

But note that, like afaik GCC, these are in fact separate compiler binaries, with a common frontend that executes them.

Marco van de Voort
+1  A: 

LLVM is a new compiler toolset, with similar goals to GCC.

Warren P