Page 1 of 1
Compiler Writing
Posted: Sun Jul 13, 2003 11:00 pm
by 1382
Would it be possible to write a compiler entirely in C?
RE:Compiler Writing
Posted: Sun Jul 13, 2003 11:00 pm
by Jamethiel
Oh, sure. Absolutely. No problem.
RE:Compiler Writing
Posted: Wed Jul 16, 2003 11:00 pm
by Zhen Lin
Just make sure you have a C compiler to compile it with. (Chicken and Egg)
GCC is completely written in C. But you can't compile it without GCC...
Why don't you use GCC instead? Modifications to BFD should be sufficient if you have a different ABI and ELF.
RE:Compiler Writing
Posted: Wed Jul 16, 2003 11:00 pm
by CarbonBased
It's even easier to modify LCC to suit your needs (afterall, that's basically what it's designed for). Specifically version 3.6. 4.0 is a better compiler, but not as well documented (there's an entire book (written by the authors of the compiler) dedicated to using, porting, and retargetting LCC 3.6)
I've modified 3.6 to use nasm as the assembler backend, and RDOFF as the object output. It took all of about half an hour
Cheers,
Jeff
RE:Compiler Writing
Posted: Sun Jul 20, 2003 11:00 pm
by Mara
I have one question. Is the compiler that you want to write dedicated to run under your own os or an amator's one, or it should run under LINUX or BeOs for example!!!!!
RE:Compiler Writing
Posted: Mon Jul 21, 2003 11:00 pm
by 1382
This is to be run under my own OS.
RE:Compiler Writing
Posted: Mon Jul 21, 2003 11:00 pm
by CarbonBased
My port of LCC is designed to run under my OS, eventually, but for the time being it runs under Linux (and should run under any OS, as long as nasm exists).
Jeff
RE:Compiler Writing
Posted: Sun Jul 27, 2003 11:00 pm
by Mara
All is OK. You should start by writing the libs and the header files that you intend to use using assembly or c itself, then start programming!
Now all depends on the executable file format that your os is using.
Have you ever written an compiler?
RE:Compiler Writing
Posted: Mon Aug 04, 2003 11:00 pm
by 1382
No, actually I haven't even written one line of the operating system, I just wanted to know 'bout the languages I can use. Thanks for you issuing the information anyway.