Re: writing a compiler...

Chris F Clark <cfc@shell01.TheWorld.com>
5 Jun 2003 23:23:11 -0400

          From comp.compilers

Related articles
writing a compiler... ltk_RE_MO_VE_@libero.it (Tommy) (2003-06-03)
Re: writing a compiler... vrotaru@seznam.cz (Vasile Rotaru) (2003-06-05)
Re: writing a compiler... m.a.ellis@ucsnew1.ncl.ac.uk (2003-06-05)
Re: writing a compiler... JeffKenton@attbi.com (Jeff Kenton) (2003-06-05)
Re: writing a compiler... cfc@shell01.TheWorld.com (Chris F Clark) (2003-06-05)
Re: writing a compiler... Steve_Lipscombe@amat.com (2003-06-08)
Re: writing a compiler... vbdis@aol.com (2003-06-20)
Re: writing a compiler... Conor.ONeill.NoSpamPlease@logicacmg.com (Conor O'Neill) (2003-06-20)
Re: writing a compiler... lex@cc.gatech.edu (Lex Spoon) (2003-06-25)
| List of all articles for this month |
From: Chris F Clark <cfc@shell01.TheWorld.com>
Newsgroups: comp.compilers
Date: 5 Jun 2003 23:23:11 -0400
Organization: The World Public Access UNIX, Brookline, MA
References: 03-06-016
Keywords: practice
Posted-Date: 05 Jun 2003 23:23:11 EDT

Tommy, you wrote:
> Finally, I would prefer not to use flex, yacc and bison (etc..),
> they are wonderful tools, but... I want to start this for my own
> pleasure and this means that I want to do all the job without using
> any external tool. This is why good advices on how to start parsing
> (for compilers), scanning, grammar etc.. are very appreciated as
> well!


Well, my first advice is to learn to use one of the tools. You use
C/C++ as a programming language rather than assembler (or raw bits and
bytes), don't you. For a compiler writer, these tools serve the same
purpose. You will find you learn a lot more by using the tools than
you do by not using them.


And, if you are really a not-invented-here type and insist on doing it
all yourself, write your own tool. Seriously, it is not a bad
exercise. Find a competent compiler text and read how to implement
one or both of the popular parsing methods, LL or LALR, and write your
own tool. (You might find Holub's book good here as he goes through
the details of writing such tools at quite a fine grained level.)


Once you have a tool and start reading and writing grammars, you will
learn that eventually you think in them. It's the same thing for
functional languages, and people who use them rarely go back to
imperative ones. (For this level of thinking I would personally
recommend Appel's book. His exercises get you to writing a functional
language compiler and that will help get you to being adept at both
compilers and functional languages.)


At that point, you probably want to learn about attribute grammars, if
you haven't already. You will find they meld quite nicely with
thinking in grammars and functional programming.


Hope this helps,
-Chris


*****************************************************************************
Chris Clark Internet : compres@world.std.com
Compiler Resources, Inc. Web Site : http://world.std.com/~compres
19 Bronte Way #33M voice : (508) 435-5016
Marlboro, MA 01752 USA fax : (508) 251-2347 (24 hours)


Post a followup to this message

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