GIDForums  

Go Back   GIDForums > Computer Programming Forums > C Programming Language
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 14-Aug-2009, 06:15
nishu1988 nishu1988 is offline
New Member
 
Join Date: Jul 2007
Posts: 10
nishu1988 is on a distinguished road

A universal compiler


I am just speculating my imagination that whether at all, is it possible to build a universal compiler....??

For example, if i am programming in c( I use turbo c++ 4.5), is it possible to embed java code and some other language so that when the program gets executed....the java code gets executed simultaneously as the remaining c code...!!


Or, if i figure it in this way...If we have one environment in which compilers of java, c, perl, pyhton are linked together...and when a program is written containing multiple codes of different languages....it gets executed accordingly.....!!!

If a program needs to use some properties of java programming, can it borrow packages from the java repository as we link header files in c, can the codes in java be intermixed with those of c....to provide a better(not best to be stated) running program and a far efficient software.I need to state in an ethical manner that nothing is impossible, then building this ultimate coding machine should not be infeasible from an amateur programmer's view at least...!!


Sorry for my ignorance, i am a newbie...and quite new to programming....!!!

looking for a reply,
Nishant
  #2  
Old 14-Aug-2009, 07:44
L7Sqr L7Sqr is offline
Member
 
Join Date: Jul 2005
Location: constant limbo
Posts: 234
L7Sqr is a jewel in the roughL7Sqr is a jewel in the rough

Re: a universal compiler...!!!


Java is compiled to bytecode that ultimately uses the system it runs on to handle its dirtywork and can therefore be run on several systems.
C is compiled to binary specific to a particular system.
Perl and python are interpreted, there is no compilation process.
Furthermore, there is the problem of language - this is a well developed field; google formal grammar for the gory details. Basically you have the problem of constructs (even if you manage to overcome the syntactical differences). For instance, how would a Java class use global data from a C program? If you eliminate the global variable situation you still have the problem of scope. Suppose you compile a c++ portion of the program and wrap a section of code in a particular namespace, this is obviously local to the resulting binary, what happens when the JVM wants to utilize this namespace? Since it defers to the host system to execute binary code this c++ section would need to exist in a separate file (or at least in a location that could be loaded by the JVM).
The things you propose, on the surface, seem plausible because it would be convenient for you the programmer. However, the details of the implementation much outweigh the benefits provided.
__________________
My personal site: Utilities for text processing, debugging, testing and plotting
  #3  
Old 20-Aug-2009, 21:44
ocicat ocicat is offline
Regular Member
 
Join Date: May 2008
Posts: 586
ocicat is a jewel in the roughocicat is a jewel in the rough

Re: a universal compiler...!!!


Quote:
Originally Posted by nishu1988
I am just speculating my imagination that whether at all, is it possible to build a universal compiler....??
...
If a program needs to use some properties of java programming, can it borrow packages from the java repository as we link header files in c, can the codes in java be intermixed with those of c....to provide a better(not best to be stated) running program and a far efficient software.
In the early '90's, Clarion (after buying out TopSpeed...) began making large claims about the compiler system they were implementing which would splice modules & libraries written in Modula-2 with others written in Pascal, C, & Ada. This was possible because they were creating the compiler themselves, so:
  • object files could be created in a compatible fashion.
  • the calling convention of parameters could be made similar across all compilers. Typically, Pascal pushes parameters from right-to-left onto the stack. C typically does the reverse..
  • This mostrous multi-language environment targeted only the Intel platform.
  • Customers supposedly were able to purchase only those languages they needed.
Surprisingly, it never made it to market.

Some say that Microsoft's move to forcing all of their languages to write to their own intermediate language is both brilliant & asinine at the same time. Yes, it does make it possible to splice C, C++, C#, & Visual Basic code together, & there may be some behind-the-scenes benefits as well, but by forcing C & C++ code to place in the IL soup, inline assembly language is no longer possible. There are trade-offs to managed code.

The reason languages are implemented differently is because they have different goals, & language designers make decisions based on various tricks & constraints. Making everyone play by the same rules doesn't always take into account why implementations were different in the first place.
  #4  
Old 21-Aug-2009, 01:56
ahbi82 ahbi82 is offline
Member
 
Join Date: Jul 2006
Posts: 203
ahbi82 will become famous soon enough

Re: a universal compiler...!!!


From my personal point view, the footprint will be increase and from the economical point of view, its not evident to have one "universal" compiler. A more economical way is the ideology to portability of software design.
  #5  
Old 21-Aug-2009, 03:55
ocicat ocicat is offline
Regular Member
 
Join Date: May 2008
Posts: 586
ocicat is a jewel in the roughocicat is a jewel in the rough

Re: a universal compiler...!!!


Quote:
Originally Posted by ahbi82
From my personal point view, the footprint will be increase and from the economical point of view, its not evident to have one "universal" compiler.
So, you're advocating the one vendor model -- just like Microsoft. Sorry, this doesn't work on multiple fronts. What happens when there is only one vendor is that they do as they please, & with no competition to keep them innovative or innovating, the public would have to do as they are told, not have products they want or need.
Quote:
A more economical way is the ideology to portability of software design.
With multiple languages which were developed for different reasons? L7Sqr has already shot holes in the impracticality in trying to mix compiled & interpreted languages. The results of such a monstrosity would be slow, bloated, & a security nightmare. No thanks.
  #6  
Old 21-Aug-2009, 07:52
Mexican Bob's Avatar
Mexican Bob Mexican Bob is offline
Regular Member
 
Join Date: Mar 2008
Location: Chicxulub, Yucatán
Posts: 341
Mexican Bob is a jewel in the roughMexican Bob is a jewel in the roughMexican Bob is a jewel in the roughMexican Bob is a jewel in the rough

Re: a universal compiler...!!!


Quote:
Originally Posted by ocicat
The results of such a monstrosity would be slow, bloated, & a security nightmare.

Amazingly you fail to recognize that your statement is exactly Microsoft's business plan!

Step 1:

Do whatever you can to make the software world belong to Microsoft.

Step 2:

Do whatever you can to ensure that no other software works with Microsoft software.

Step 3:

Prevent all competition from securing a foothold in the marketplace.

Step 4:

Ensure that continual upgrades are a requirement.

Step 5:

Make the hardware vendors bow toward Redmond before any can be sold.



MxB
  #7  
Old 21-Aug-2009, 20:08
ahbi82 ahbi82 is offline
Member
 
Join Date: Jul 2006
Posts: 203
ahbi82 will become famous soon enough

Re: a universal compiler...!!!


Quote:
Originally Posted by ocicat
So, you're advocating the one vendor model -- just like Microsoft. Sorry, this doesn't work on multiple fronts. What happens when there is only one vendor is that they do as they please, & with no competition to keep them innovative or innovating, the public would have to do as they are told, not have products they want or need.

Maybe you can enlighten me how Universal Compiler resolves the "One Vendor" problem.

Quote:
With multiple languages which were developed for different reasons? L7Sqr has already shot holes in the impracticality in trying to mix compiled & interpreted languages. The results of such a monstrosity would be slow, bloated, & a security nightmare. No thanks.

This means universal compiler will become problems of problems.
  #8  
Old 22-Aug-2009, 14:44
ocicat ocicat is offline
Regular Member
 
Join Date: May 2008
Posts: 586
ocicat is a jewel in the roughocicat is a jewel in the rough

Re: a universal compiler...!!!


Quote:
Originally Posted by ahbi82
Maybe you can enlighten me how Universal Compiler resolves the "One Vendor" problem.
It doesn't.
Quote:
This means universal compiler will become problems of problems.
Exactly.

The assumption you are making is that "Hey! why should I have to reinvent a statistical library because Fortran had LINPACK? Why should I have to reimplement GUI libraries because Java has Swing?"

The answer is to become fluent enough in different languages & proficient as an engineer such that you choose the tool which best solves the problem. Invariably, really useful libraries get ported to multiple languages, & if you can't find what you want, write it yourself.
  #9  
Old 06-Nov-2009, 01:10
Rojin Rojin is offline
New Member
 
Join Date: Nov 2009
Posts: 1
Rojin is on a distinguished road

Re: A universal compiler


any present compiler for it now ???
  #10  
Old 06-Nov-2009, 03:05
ahbi82 ahbi82 is offline
Member
 
Join Date: Jul 2006
Posts: 203
ahbi82 will become famous soon enough

Re: A universal compiler


Quote:
Originally Posted by Rojin
any present compiler for it now ???

No. But u can google for U++.

http://www.ultimatepp.org/
 
 

Recent GIDBlogProblems with the Navy (Officers) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
my code has errors.. HELP bengt23648 C Programming Language 5 18-Aug-2007 09:48
Online C Compiler. shoaibjameel123 C Programming Language 5 09-Jun-2007 23:50
C++ Compiler Reads C Source Codes eddykk C Programming Language 2 15-Apr-2006 08:23
Newbie : need help with Dev-C++ compiler batrsau C++ Forum 2 20-Mar-2005 21:05

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 07:47.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.