|A C style compiler. Matthew.Webb@net1.demon.co.uk (Matthew Webb) (1998-04-29)|
|Re: A C style compiler. firstname.lastname@example.org (1998-05-04)|
|Re: A C style compiler. email@example.com (Francois-Rene Rideau) (1998-05-04)|
|From:||firstname.lastname@example.org (Derek B. Noonburg)|
|Date:||4 May 1998 23:03:20 -0400|
|Organization:||Verio Northern California's Usenet News Service|
Matthew Webb <Matthew.Webb@net1.demon.co.uk> writes:
> I am writting a OS in assembly language but to speed up the main
> development of it I would like to create assembly 'macro'
> assembly/compiler. Basically I would like to go half way from assembly
> to C. I need to create my own format as it is a new OS and does not
> have a platform executable yet.
> [My advice is "don't do that", since it's entirely possible to write
> a small, tight OS predominantly in C, e.g. QNX. -John]
Sure, but writing everything from scratch can be *fun*. (On the other
hand, if you're doing this because you think you'll get faster code or
something, John's right -- don't bother.)
You might want to take a look at the old Small C compiler. It was a
very simple C-subset compiler that generated 8080 (I think) assembly.
The compiler was written in Small C itself, but it should give you
lots of ideas. Ripping out the parts you want and translating to
assembly should be pretty simple. At the very least, you'll learn a
lot by reading through the code. (It doesn't use any of the stuff
from the Dragon Book that probably confused you.)
I actually half-finished a compiler for the TMS9900, written in
assembly, and based on Small C, back in high school.
The entire thing, source code and all, was published in Dr. Dobb's
Journal, many years ago. Maybe you can track it down at a library.
There's also a book called by James E. Hendrix called _A Small C
Compiler: Language, Usage, Theory, and Design_, though amazon.com says
it's out of print.
[It's reappeared on CD-ROM, see the FAQ. -John]
Return to the
Search the comp.compilers archives again.