<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>
&nbsp;<BR>
Well I took Stanford CS143, so here's my modest take:<BR>
- your task depends largely on whether you're tackling some arbitrary syntax<BR>
someone just made up, or parsing some well-known&nbsp;standardized language<BR>
(e.g. Scheme, Lisp, Haskell,&nbsp;C&nbsp;etc.).<BR>
(FYI gcc uses an ad-hoc parser under-the-hood for raw speed, not a yacc-generated one.)<BR>
- the dragon book (Aho, Sethi, Ullman) is, if I may say, pretty awful,<BR>
a bad read,&nbsp;clunky typesetting, inadequate examples (Pascal fragments?)<BR>
and dwells morbidly on parsing theory. All you really need to know in the real<BR>
world is that yacc/bison will handle SLR(1) grammars, which are the only ones<BR>
we care about, and we handle ambiguity in expressions via operator<BR>
precedence and associativity rules.<BR>
Corollary: if yacc rejects your grammar and you can't fix it, it ain't SLR(1).<BR>
It seems like computer scientists love to go overboard on this theory, NFAs and so on.<BR>
You only need an appreciation of how they work, and to familiarize yourself<BR>
with how yacc runs by trying to build a grammar for&nbsp;a subset of C (or Scheme).<BR>
- I am not aware of any more approachable book, but in either case,<BR>
&nbsp;better than any book is to take Stanford CS143 via<BR>
&nbsp; Stanford Online, it runs almost every semester.<BR>
If you're too busy to do the 4 programming exercises (which are the most<BR>
valuable part of the course), then just take it CR/NC or Audit.<BR>
- I have no opinion on "Essentials of Programming Languages" (2nd ed),<BR>
but from the reviews it sounds slightly better and does&nbsp;mention Scheme.<BR>
- Basically this is one of the those topics you will learn infinitely more by doing<BR>
than by&nbsp;reading. With any of these books, be prepared to speed-read or<BR>
skim the hundreds of pages that are not directly relevant to your needs.<BR>
- If you get as far as code generation, you will come to detest explicit<BR>
pointers even more than you already do (not applicable to Scheme).<BR>
&nbsp;<BR>
PS Anyway, are you doing this as a learning exercise, or is there genuinely no<BR>
existing off-the-shelf open-source parser that will fit your needs?<BR>
&nbsp;<BR>
Regards,<BR>
Stephen<BR>
<BR>&nbsp;<BR>

<HR>
<BR>
Date: Thu, 31 Jul 2008 01:23:58 -0700<BR>From: jjinux@gmail.com<BR>To: baypiggies@python.org<BR>Subject: [Baypiggies] How to Implement Compilers and Interpreters<BR><BR><BR>
<DIV dir=ltr>I'm looking for some advice implementing compilers and interpreters.&nbsp; If you know about such things, can you respond to my blog post?<BR><BR><A href="http://jjinux.blogspot.com/2008/07/computer-science-how-to-implement.html" target=_blank>http://jjinux.blogspot.com/2008/07/computer-science-how-to-implement.html</A><BR><BR>Thanks,<BR>-jj<BR><BR>-- <BR>Lisp programmers know the value of everything, but the cost of nothing...<BR>On my Lisp, '() costs 4 bytes.<BR><A href="http://jjinux.blogspot.com/" target=_blank>http://jjinux.blogspot.com/</A><BR></DIV><br /><hr />With Windows Live for mobile, your contacts travel with you. <a href='http://www.windowslive.com/mobile/overview.html?ocid=TXT_TAGLM_WL_mobile_072008' target='_new'>Connect on the go.</a></body>
</html>