Re: Compiler Tools v. C

Scott Nicol <scott@INFOADV.MN.ORG>
Sat, 29 Apr 1995 01:53:51 GMT

          From comp.compilers

Related articles
Compiler Tools v. C johnf@cpsc.ucalgary.ca (1995-04-28)
Re: Compiler Tools v. C scott@INFOADV.MN.ORG (Scott Nicol) (1995-04-29)
Re: Compiler Tools v. C shepherd@schubert.sbi.com (1995-05-04)
Re: Compiler Tools v. C scott@INFOADV.MN.ORG (Scott Nicol) (1995-05-12)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Scott Nicol <scott@INFOADV.MN.ORG>
Keywords: tools, design, comment
Organization: Compilers Central
References: 95-04-167
Date: Sat, 29 Apr 1995 01:53:51 GMT

>I would like some advice from some of you Old-Dog-Compiler-Designers :)


I don't think I'm an old dog yet, but I'll try to answer your question
anyway.


>I know that compiler tools are used a lot in industry, and I will pick up
>these skills in grad school or else where. My question is similar to the
>debate on how much C should be learned before jumping to C++. Would a student
>gain more insight through developing a proper back end in C rather than
>makeing the jump to YACC? The obvious assumption that I have made is that
>tools will hide the nitty-gritty implementation details. Is this assumption
>justifyed, and if so, do the imlementation details of the back end warrent
>8 months of undergrad research?


I'm not sure I understand you. YACC is used for creating a parser.
YACC makes it easy to write a parser because the input to yacc closely
resembles BNF. Still, I think it is worthwhile to write a small
recursive descent parser once, just to see how its done (Stroustrup's
C++ bible has a nicely worked out example). I assume you have already
done this with your PASCAL compiler?


Lex, on the other hand, is not very useful. The man page for Lex at
Bell Labs has the following in the "BUGS" section:


The asteriod to kill this dinosaur is still in orbit.


If you want to anything the least bit tricky, it is worth it to spend a
few hours and write a hand-crafted scanner. The code isn't difficult,
and you gain speed, flexibility, and portability.


If you want to learn about YACC, I highly recommend the O'Reilly book.
I can also recommend MKS YACC (for DOS, OS/2 only, I think), as it can
symbolically trace the grammar, and the manual is fairly complete
(Disclaimer: I used to work for MKS, and I was responsible for Lex and
YACC (among other things)).


--
Scott Nicol email: scott@infoadv.mn.org
Information Advantage, Inc. work: (612) 820-3846
Edina, MN home: (612) 488-5406
[I agree that lex is too slow and buggy to be useful, but flex actually
works and can be pretty handy. -John]
--


Post a followup to this message

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