From: | Arch Robison <robison@kai.com> |
Newsgroups: | comp.compilers |
Date: | 3 Jan 1997 23:16:53 -0500 |
Organization: | Kuck & Associates, Inc. |
References: | 97-01-013 |
Keywords: | practice |
synaptik@why.net (synaptik) writes:
>Let me preface my question by stating that I have read what relevant
>FAQs I could find,... yadda yadda yadda.
>
>I am interesting it "trying my hand" at writing a 'C' compiler. I
Students regularly write simple compilers in one semester courses.
It's not difficult to write a basic non-optimizing compiler.
>My question is... what is it that makes compiler development so difficult?
Support for dialects, multiple backends, debug information,
optimization, and shifting specifications.
Commercial C compilers are expected to support at least K&R, ANSI, and
usually a combination dialect. (And often minor variants such as
making char signed or unsigned.) The compilers often have to support
multiple instruction sets and variants of those instruction sets.
(E.g., 32-bit and 64-bit.) Debug information has to be maintained.
Optimization can be a whole industry itself (that's how our company
got started!)
Of course, doing all that got too easy for C and Fortran 77, so the
gods handed down F90 and C++. These languages are so complicated to
parse that whole companies are devoted to just parsing them! And the
C++ is still being standardized, so it shifts.
Then there's the GUI and Integrated Development environment. And
incremental compilation etc.
But even if all the above is easy, there's the root problem:
Customers demand features.
Unfortunately, N customers each demand "one little feature". Which
leads to O(N*N) pairwise feature interactions. Each of N customers
understands "their" feature, but no human can understand all of them
together.
>Forgive my ignorance, but I have always thought it would
>be a fun project, but then become disillusioned when I pick up a book
>on compiler theory and it doesn't appear "straight forward."
Don't be disillusioned. Writing compilers can be fun and educational.
If you're writing it as a hobby, *you* and not the market get to
decide what's important to implement and what is not. Have fun!
My only critique would be the choice of C. If you're not market
driven, search for a novel/interesting/saner language. The world
already has too many C compilers.
Arch D. Robison Kuck & Associates Inc.
robison@kai.com 1906 Fox Drive
217-356-2288 Champaign IL 61820
Lead Developer for KAI C++ http://www.kai.com/C_plus_plus/index.html
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.