Re: Bottom-up versus Top-down

Henry Spencer <henry@zoo.toronto.edu>
2 Dec 1997 12:09:26 -0500

          From comp.compilers

Related articles
Bottom-up versus Top-down jacko@post8.tele.dk (Jack Olsen) (1997-11-23)
Re: Bottom-up versus Top-down thetick@magelang.com (Scott Stanchfield) (1997-11-24)
Re: Bottom-up versus Top-down gnb@itga.com.au (Gregory Bond) (1997-11-28)
Re: Bottom-up versus Top-down gclind01@spd.louisville.edu (1997-11-29)
Re: Bottom-up versus Top-down mkgardne@cs.uiuc.edu (1997-11-30)
Re: Bottom-up versus Top-down henry@zoo.toronto.edu (Henry Spencer) (1997-11-30)
Re: Bottom-up versus Top-down rod.bates@wichita.boeing.com (Rodney M. Bates) (1997-12-02)
Re: Bottom-up versus Top-down henry@zoo.toronto.edu (Henry Spencer) (1997-12-02)
Re: Bottom-up versus Top-down thetick@magelang.com (Scott Stanchfield) (1997-12-02)
Re: Bottom-up versus Top-down dwight@pentasoft.com (1997-12-02)
Re: Bottom-up versus Top-down neitzel@gaertner.de (1997-12-05)
Re: Bottom-up versus Top-down jmccarty@sun1307.spd.dsccc.com (1997-12-05)
Re: Bottom-up versus Top-down sperber@informatik.uni-tuebingen.de (1997-12-07)
Re: Bottom-up versus Top-down henry@zoo.toronto.edu (Henry Spencer) (1997-12-07)
[4 later articles]
| List of all articles for this month |
From: Henry Spencer <henry@zoo.toronto.edu>
Newsgroups: comp.compilers
Date: 2 Dec 1997 12:09:26 -0500
Organization: SP Systems, Toronto
References: 97-11-123 97-11-155 97-11-178
Keywords: C, parse

Mark K. Gardner <mkgardne@cs.uiuc.edu> (or perhaps our moderator) wrote:
>[I did not witness the events first-hand, but it appears that LALR
>grew strength from languages, like C, that were difficult if not
>impossible to cast as LL grammars, while LL took root in the Pascal
>languages...


This is actually somewhat amusing, because the first C compiler in fact
used a top-down parser, and one of the early implementors of a bottom-up
C parser (Steve Johnson) complained in print that the language was designed
for top-down and was awkward to parse bottom-up!


Speaking as someone who has written a top-down parser for full ANSI C,
it's a little messy in spots, and there are a couple of places where you
need to cheat with a bit of extra lookahead, but it's neither impossible
nor immensely difficult. Annoying, yes, but entirely feasible.
--
| Henry Spencer
| henry@zoo.toronto.edu
[Hey, the Ritchie C compiler wasn't entirely top down. It did expressions
bottom up with a little operator precedence grammar. -John]




--


Post a followup to this message

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