Re: [QUERY] A "ignorant newbie" question about compiler-writing.

dennis@netcom.com (Dennis Yelle)
3 Jan 1997 23:10:38 -0500

          From comp.compilers

Related articles
[QUERY] A "ignorant newbie" question about compiler-writing. synaptik@why.net (1997-01-02)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. dennis@netcom.com (1997-01-03)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. jlilley@empathy.com (1997-01-03)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. robison@kai.com (Arch Robison) (1997-01-03)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. mw@ipx2.rz.uni-mannheim.de (1997-01-04)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. kanze@gabi-soft.fr (1997-01-29)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. kanze@gabi-soft.fr (1997-01-29)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. mw@ipx2.rz.uni-mannheim.de (1997-01-30)
[11 later articles]
| List of all articles for this month |
From: dennis@netcom.com (Dennis Yelle)
Newsgroups: comp.compilers
Date: 3 Jan 1997 23:10:38 -0500
Organization: Very little
References: 97-01-013
Keywords: design

synaptik@why.net (synaptik) writes:
>My question is... what is it that makes compiler development so
>difficult? 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."
>
>To me, the process seems simple:
>
>--Write a preprocessor that "digests" the source (include-file
>insertion, commment-and-whitespace removal, and macro expansion)
>--Write a "compiler" that parses the digested 'C' source into the
>targetted format.
>
>(In my case, the targetted format would be a byte-code definition; I
>want to implement this in a quasi-interpretted fashion.)


You are right, the C preprocessor is actually a simple thing.
Especially since ANSI told us that it doesn't know about sizeof(). If
you have never done anything like this before, I think that a stand
alone C preprocessor would be a nice project.


The C language itself is surprisingly complex. It seems simple to me
because I learned it after I learned Fortran, Pascal, and Assembler
for a few machines. But, actually, there is a lot to it. It just
seems simple because much of it seems so natural, for those of us with
the "right" background. You have a good idea about generating some
kind of byte-code to be interpreted. This eliminates two anoying
problems: generating actual machine instructions, and learning the
object file format that the linker wants to see.


As to your actual question: "What is so difficult about writing a C
compiler?" I am reminded that when the first spreadsheet programs
were released some of thought that writing a spreadsheet was a weekend
project. And for some of us it was.


The only way YOU will find out what is so difficult for YOU is to
actually start the project. Since I don't know your abilities, and I
don't know how much spare time you have, I really can't give you the
answer. But, as I said above: If you have never done anything like
this before, I think that a stand alone C preprocessor would be a nice
project.


--
dennis@netcom.com (Dennis Yelle)
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.