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

synaptik@why.net (synaptik)
2 Jan 1997 23:12:57 -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 conor@aethos.co.uk (Conor O'Neill) (1997-01-09)
Re: [QUERY] A "ignorant newbie" question about compiler-writing. kanze@gabi-soft.fr (1997-01-29)
[13 later articles]
| List of all articles for this month |

From: synaptik@why.net (synaptik)
Newsgroups: comp.compilers
Date: 2 Jan 1997 23:12:57 -0500
Organization: The Why? Network
Keywords: question


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
have read this news group a bit, and I understand that compiler
development tools (such as "lexx" and "yacc") exist for this very
purpose. I am a "basement hobbyist" who's hobby is programming. It
is safe to assume that I have not taken any compiler theory courses;
but I have flipped through a few books on the subject (probably even
the "dragon" book.)

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.)

To me, it seems that the hardest part will be parsing logical and
numerical expressions, (I intend to convert them to pre-order
notation, and then generate a byte-code equivalent,) but the rest
almost seems like a cake walk (although a lengthy and detailed
process, obviously.)

Then, I browse the above mentioned books, and this newsgroup, and I
start to wonder if there are some fundamental difficulties that I am
just not enlightened enough to see.

Can someone explain to me why this problem is more difficult than I
perceive it to be?

I am not looking for flames, I'm just trying to decide whether this is
something I want to attempt or not. (I would prefer, if possible, to do
it from scratch, and not use a tool, like lex or yacc.)
[There's a lot of details to get right, like symbol definitions, declaration
scopes, data type coercions, and all the other odds and ends you need to
make a working compiler. Parsing arithmetic expressions is actually pretty
easy. -John]


Post a followup to this message

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