0

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?

3
Contributors
6
Replies
32
Views
4 Years
Discussion Span
Last Post by Chinthanie
0

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

Edited by Ancient Dragon

0

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?

1

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.

1

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.

0

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?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.