954,506 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

what is the best compiler

what is the best compiler out there that you can use for a variety of languages.
Like is their a compiler that can compile c++, the basics, java, etc.
I am just looking for a good compiler that is free and if possible can compile more than one prog. lang.

mikeandike22
Nearly a Posting Virtuoso
1,496 posts since May 2004
Reputation Points: 33
Solved Threads: 19
 

>what is the best compiler
What's the best pizza topping? Try again.

>what is the best compiler out there that you can use for a variety of languages. Like is their a compiler that can compile c++, the basics, java, etc.
Better. No such compiler exists. The closest you will get is a C++ compiler that can also handle C. Try again.

>I am just looking for a good compiler that is free and if possible can compile more than one prog. lang.
Now I know what you're looking for. Here is your best bet.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

ok thanks i will test it out. It would just be cool if there was some super compiler. It would save a lot of time if you have to program in different langs for diff things.

mikeandike22
Nearly a Posting Virtuoso
1,496 posts since May 2004
Reputation Points: 33
Solved Threads: 19
 

>It would just be cool if there was some super compiler.
Yes, it would. But the lexical analyzer would be a bitch to write.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

i guess but couldn't you just take like ten compilers and put em into one program.

and keep the language clean

mikeandike22
Nearly a Posting Virtuoso
1,496 posts since May 2004
Reputation Points: 33
Solved Threads: 19
 

>i guess but couldn't you just take like ten compilers and put em into one program.
Yes, but you would have the same problem if this were some kind of smart supercompiler. The problem is figuring out which language is being used and then calling the proper internal program. The only way that this could be done without serious coding effort on the part of the compiler writer would be to use a compilation switch:

$ sc -lang=C src.c
Compiling C code...

$ sc -lang=Pascal src.pas
Compiling Pascal code

$ sc -lang-Fortran90 src.f90
Compiling Fortran90 code

And so on. Anything else would introduce some form of common comment that specifies which compiler to call or requires the lexical analyzer to figure out from context what kind of language is being used. The former kills portability to other compilers and the latter would be a nightmare. The switch option is a good one, though the effort expended in developing this supercompiler wouldn't be worth the convenience gained by using a switch instead of a different compiler.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

:o The best compiler may be a preprocessor that uses a set of macros and easy to understand code to write your program, then translates this to C/C++ code that one of those free C/C++ compiler can take to do the compiling and linking.

The closest thing to this is BCX, a fairly mature system that uses modified basic and allows inline asm and C code.
There is even a visual IDE. Best of all the whole package, BCX translator, PellesC, IDE, Editor, very good help file, a bunch of sample code and more can be had for free!

Download from:
http://www.rjpcomputing.com/programming/bcx/

I have used this package for a while now and have enjoyed its flexibility,tight code and executables.

Below is a example BCX code to load a bitmap into a window form. You can take a good look at the generated C code, which is of course much more complex. This should convince you.

' load a bitmap file to a form

GUI "Bitmap1"

DIM Form1 AS CONTROL
DIM Bitm1 AS CONTROL

SUB FORMLOAD
' create a form 310x250
Form1 = BCX_FORM ("Bitmap from file", 0, 0, 310, 250)
' load the bitmap, upper left corner x=1 y=1, auto size
Bitm1 = BCX_BITMAP("demo.bmp",Form1,1234,1,1,0,0)

CENTER(Form1) ' center on display screen
SHOW (Form1)
END SUB

BEGIN EVENTS
' use default stuff, exit etc.
END EVENTS

vegaseat
DaniWeb's Hypocrite
Moderator
5,989 posts since Oct 2004
Reputation Points: 1,345
Solved Threads: 1,417
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You