i need to write a compiler in C language and need to attach it to the windows os as a plugin. what do you think about this? is this possible?

Recommended Answers

All 6 Replies

windows os doesn't have anything called a "plugin". They are just application programs. Or do you mean a browser plugin?

Yes, you can write your own compiler, but plan to spend several years doing it. Go to amazon.com and search for compiler books,

Here is an online c++ compiler

then what about ubuntu?
the other thing is..... if i hv written the compiler can i use it to compile programs written using more than one language?
is there a possibility to write such a common compiler?

I suppose it would be possible, but the compiler would probably be too huge to fit in memory. That's why compilers stick to just a single language. If you want more than one language, then write a compiler for each language, then write a wrapper program to call the appropriate compiler for the desired language. Microsoft Visual Studio is such a wrapper program and contains compilers for C, C++, C#, VB.NET and several other languages.

is there a possibility to write such a common compiler?

Most compilers out there are written as a front-end and back-end duo. The front-end takes care of parsing the language, applying syntax rules and converting all the code into a simpler kind of code (usually something close to the C language). Then the back-end takes that intermediate code and does all the final optimizations and the assembly into machine code that targets a given architecture (CPU). Most compiler suites share the same back-end for all languages, and simply provide a different front-end for each language. This is the case for GCC (GNU Compiler Collection), ICC (Intel Compiler Collection), Clang / LLVM, etc... So, yes, it is possible to write such a "common compiler", in fact, it is the only viable solution in the long-run if you want to support multiple languages. But, of course, it makes no sense to have one front-end that can deal with all languages, you just have one separate front-end for each language, all using a common back-end.

thanks for the replies........... i'hv more Qs....

what do u think about attaching an expert system written using CLIPS to the C compiler to do optimization or preprocessing the source code?

the other Q is what is the role of JVM as a compiler?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.