Programing Languages

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
larryrl
Posts: 9
Joined: Thu 07 Oct 2010, 21:17

Programing Languages

#1 Post by larryrl »

Why is it almost every programming language for linux must be compiled using a c++ compiler?

Mzg
Posts: 23
Joined: Mon 04 Oct 2010, 12:45

#2 Post by Mzg »

Um, only C++ can be compiled with a C++ compiler...

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#3 Post by disciple »

No, that's not what he means.
e.g. Python itself (not code written in the Python language) is written in C and compiled with ./configure; make; make install
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

Mzg
Posts: 23
Joined: Mon 04 Oct 2010, 12:45

#4 Post by Mzg »

That makes sense. I.e. the interpreters/compilers must be compiled, not the programming language.

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#5 Post by disciple »

Larry,
How else would you expect to build them?
Do you know a good gtkdialog program? Please post a link here

Classic Puppy quotes

ROOT FOREVER
GTK2 FOREVER

User avatar
gary
Posts: 89
Joined: Fri 21 Dec 2007, 18:14
Location: Cartersville, GA

#6 Post by gary »

Isn't C++ just a pre-processor for C anyway? That is, the pre-processor accepts C++ and rewrites it as C source, which is then further pre-processed into assembly source, then ultimately assembled into binary for the target CPU. Many "compilers" allow you to stop and examine the code generated at each stage. Using the pre-process technique, it seems to me nearly any language could be designed who's output would be C source code.
[b]Hasten Slowly![/b]

User avatar
Pizzasgood
Posts: 6183
Joined: Wed 04 May 2005, 20:28
Location: Knoxville, TN, USA

#7 Post by Pizzasgood »

Compiled languages need a compiler to compile them, and interpreted languages need an interpreter to interpret them. Those programs have to come from somewhere. Once you have a compiler for the language, you can of course write a new compiler for the language using the language itself. But before you reach that point you have a chicken and egg scenario. The simplest solution is to first write a compiler for the language in a different language that is already set up. The typical choice is C because it's pretty much the most common language you're going to find on nearly any platform. You write a compiler for your language using C, then you write another compiler for the language, this time using the language itself, and compile it using the compiler that was written in C. Now you are free from needing C, on this platform. However, if you want to make the language availible on another platform (like Mac or Windows, or an ARM processor, etc.) you'd have to either bring back the C version of the compiler so that it can be recompiled natively on the destination platform, or else implement a cross-compiler so that you can compile a compiler ahead of time.

If any of that is confusing, sorry. I should have gone to sleep a while ago.
[size=75]Between depriving a man of one hour from his life and depriving him of his life there exists only a difference of degree. --Muad'Dib[/size]
[img]http://www.browserloadofcoolness.com/sig.png[/img]

Post Reply